rsnext/packages/next/tsconfig.json
Wyatt Johnson cdf1d52d9a
next/navigation Typescript support for pages/ (#45919)
When you're trying to migrate an application from `pages/` to `app/`,
you'll need to access data like search parameters and the pathname in a
way that lets you migrate safely.

This adds support for dynamic typing of some of those exported functions
from `next/navigation`, namely `useSearchParams` and `usePathname`.
Currently, `searchParams` can’t be known when prerendering if the page
doesn’t use [Server-side
Rendering](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props)
in the `pages/` directory. `pathname` can’t be known during prerendering
if the page is a fallback page or has been automatically statically
optimized when accessed from `pages/`.

To make migraitons easier, this adds a new feature to `next dev` that
will automatically add the correct types for `next/navigation`. It does
this by checking if you have both a `app/` and `pages/` directory. If it
detects you have a `app/` directory, it will also enable the suggested
Typescript feature,
[`structNullChecks`](https://www.typescriptlang.org/tsconfig#strictNullChecks)
which will warn developers when trying to access a value that may be
`null`.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-02-14 17:26:01 -08:00

23 lines
484 B
JSON

{
"extends": "../../tsconfig-tsec.json",
"compilerOptions": {
"strict": true,
"module": "esnext",
"target": "ES2017",
"esModuleInterop": true,
"moduleResolution": "node",
"jsx": "react",
"stripInternal": true
},
"exclude": [
"dist",
"./*.d.ts",
"future/*.d.ts",
"image-types/global.d.ts",
"compat/*.d.ts",
"legacy/*.d.ts",
"types/compiled.d.ts",
"navigation-types/*.d.ts",
"navigation-types/compat/*.d.ts"
]
}