Tracking branch for Next.js’s upcoming TypeScript #458
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current 8.1.1 canary track includes native TypeScript support, which
includes official types for Next.js objects and out-of-the-box
TypeScript compilation. This is good! But it means we have to adapt some
of our existing TypeScript stuff.
As of this writing, Next.js enforces that the app directory contain its
own tsconfig.json file (vercel/next.js#7333), so this PR adds those as
necessary, inheriting from the parent package’s configuration. It also
requires a handful of specific configurations, so those are included as
well (vercel/next.js#7361) in those files.
This change also hoists acorn and acorn-dynamic-import because those two
packages need to be in a consistent place relative to each other and
webpack. (vercel/next.js#6240)
Currently the 'next' module does not export a type for its constructor
function, so we switch 'import next' to 'const next = require' to avoid
the typechecking.
We add "export {}" to the bottom of files that don’t do their own import
/ exporting to avoid an error due to the required "isolatedModules"
setting. (These can be removed if "isolatedModules" is removed.)
The bulk of the changes are updating _app and _document classes to the
nice new types.