Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

global.d.ts

99 lines2.8 KB

1/// <reference types="vite/client" />
2​
3declare module '@rspack/core/rsc/ssr' {
4 export function setOnClientReference(
5 callback:
6 | ((reference: {
7 id: string
8 deps: { js: Array<string>; css: Array<string> }
9 runtime: 'rsbuild'
10 }) => void)
11 | null
12 | undefined,
13 ): void
14 export function getManifest(): {
15 moduleCssFiles?: Record<string, Array<string>>
16 [key: string]: unknown
17 }
19​
20declare module '@rspack/core/rsc/browser' {
21 export function getManifest(): {
22 moduleCssFiles?: Record<string, Array<string>>
23 [key: string]: unknown
24 }
26​
27/**
28 * Type declarations for virtual:tanstack-rsc-runtime
29 *
30 * This virtual module is provided by the active Start bundler adapter
31 * and re-exports RSC runtime functions from that adapter's Flight runtime.
32 *
33 * Using a virtual module allows the imports to be resolved at runtime within
34 * the correct server environment context (react-server conditions).
35 */
36declare module 'virtual:tanstack-rsc-runtime' {
37 export function renderToReadableStream<T>(
38 data: T,
39 options?: object,
40 ): ReadableStream<Uint8Array>
41 export function createFromReadableStream<T = unknown>(
42 stream: ReadableStream<Uint8Array>,
43 options?: object,
44 ): Promise<T>
45 export function createTemporaryReferenceSet(): object
46 export function decodeReply<T = unknown>(
47 body: string | FormData,
48 options?: object,
49 ): Promise<T>
50 export function loadServerAction(id: string): Promise<(...args: any) => any>
51 export function decodeAction<T = unknown>(
52 body: FormData,
53 serverManifest?: unknown,
54 ): Promise<() => T>
55 export function decodeFormState<T = unknown>(
56 actionResult: T,
57 body: FormData,
58 serverManifest?: unknown,
59 ): Promise<unknown>
61​
62declare module 'virtual:tanstack-rsc-browser-decode' {
63 export function createFromReadableStream<T = unknown>(
64 stream: ReadableStream<Uint8Array>,
65 options?: object,
66 ): Promise<T>
67 export function createFromFetch<T = unknown>(
68 response: Promise<Response>,
69 ): Promise<T>
71​
72declare module 'virtual:tanstack-rsc-ssr-decode' {
73 export function setOnClientReference(
74 callback:
75 | ((reference: {
76 id: string
77 deps: { js: Array<string>; css: Array<string> }
78 runtime?: 'rsbuild'
79 }) => void)
80 | undefined,
81 ): void
82 export function createFromReadableStream<T = unknown>(
83 stream: ReadableStream<Uint8Array>,
84 options?: object,
85 ): Promise<T>
87​
88/**
89 * Type declarations for virtual:tanstack-rsc-hmr
90 *
91 * This virtual module is provided by the active Start bundler adapter
92 * and sets up the RSC HMR listener in dev mode. It listens for 'rsc:update'
93 * events and invalidates the router to refetch server components.
94 *
95 * In production builds, this module is empty.
96 */
97declare module 'virtual:tanstack-rsc-hmr' {
98 export function setupRscHmr(): void