cdf1d52d9a
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> |
||
---|---|---|
.. | ||
compat | ||
navigation.d.ts |