-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(types): expanded typescript support;
testApiHandler
weakly typ…
…ed by default Previously, `testApiHandler` accepted a `NextApiHandlerType` generic parameter that _defaulted to `unknown`_. This parameter is passed to the `NextApiHandler` generic type directly. With this change: 1) `NextApiHandlerType` has been renamed to the more descriptive `NextResponseJsonType` 2) `NextApiHandlerType` defaults to `any` instead of `unknown` 3) The `.json()` method on the `Response` object (returned by `await fetch()`) now returns a `NextResponseJsonType` object instead of an `any` object. tl;dr: NTARH can be as strongly typed as needed, but isn't as pushy about it :)
- Loading branch information
Showing
5 changed files
with
70 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters