Unverified Commit 2eeaeb06 authored by Janka Uryga's avatar Janka Uryga Committed by GitHub

[Instant] export "Instant" config type (#90257)

We forgot to export a type for the `unstable_instant` config. This works
now

```tsx
import type { Instant } from 'next'
export const unstable_instant: Instant = { ... }
```
parent fbe034ae
...@@ -46,10 +46,8 @@ const InstantConfigSchema = z.union([ ...@@ -46,10 +46,8 @@ const InstantConfigSchema = z.union([
z.literal(false), z.literal(false),
]) ])
export type InstantConfig = InstantConfigStatic | InstantConfigRuntime | false export type Instant = InstantConfigStatic | InstantConfigRuntime | false
export type InstantConfigForTypeCheckInternal = export type InstantConfigForTypeCheckInternal = __GenericInstantConfig | Instant
| __GenericInstantConfig
| InstantConfig
// the __GenericPrefetch type is used to avoid type widening issues with // the __GenericPrefetch type is used to avoid type widening issues with
// our choice to make exports the medium for programming a Next.js application // our choice to make exports the medium for programming a Next.js application
// With exports the type is controlled by the module and all we can do is assert on it // With exports the type is controlled by the module and all we can do is assert on it
...@@ -233,7 +231,7 @@ export type AppSegmentConfig = { ...@@ -233,7 +231,7 @@ export type AppSegmentConfig = {
/** /**
* How this segment should be prefetched. * How this segment should be prefetched.
*/ */
unstable_instant?: InstantConfig unstable_instant?: Instant
/** /**
* The preferred region for the page. * The preferred region for the page.
......
...@@ -29,7 +29,7 @@ import { parseLoaderTree } from '../../../shared/lib/router/utils/parse-loader-t ...@@ -29,7 +29,7 @@ import { parseLoaderTree } from '../../../shared/lib/router/utils/parse-loader-t
import type { GetDynamicParamFromSegment } from '../app-render' import type { GetDynamicParamFromSegment } from '../app-render'
import type { import type {
AppSegmentConfig, AppSegmentConfig,
InstantConfig, Instant,
} from '../../../build/segment-config/app/app-segment-config' } from '../../../build/segment-config/app/app-segment-config'
import { Readable } from 'node:stream' import { Readable } from 'node:stream'
import { import {
...@@ -84,7 +84,7 @@ export type RouteTree = { ...@@ -84,7 +84,7 @@ export type RouteTree = {
module: null | { module: null | {
type: 'layout' | 'page' type: 'layout' | 'page'
// TODO(instant-validation): We should know if a layout segment is shared // TODO(instant-validation): We should know if a layout segment is shared
instantConfig: InstantConfig | null instantConfig: Instant | null
conventionPath: string conventionPath: string
} }
......
...@@ -40,6 +40,8 @@ export type { ...@@ -40,6 +40,8 @@ export type {
ResolvedViewport, ResolvedViewport,
} from './lib/metadata/types/metadata-interface' } from './lib/metadata/types/metadata-interface'
export type { Instant } from './build/segment-config/app/app-segment-config'
export type { Instrumentation } from './server/instrumentation/types' export type { Instrumentation } from './server/instrumentation/types'
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment