@dr.pogodin/react-utils
Version:
Collection of generic ReactJS components and utils
27 lines (26 loc) • 864 B
TypeScript
import type { Request } from 'express';
import { type SsrContext } from '@dr.pogodin/react-global-state';
/** Mapping "chunkName" > array of asset paths. */
export type ChunkGroupsT = Record<string, string[]>;
export type InjT = {
CHUNK_GROUPS?: ChunkGroupsT;
CONFIG?: Record<string, unknown>;
ISTATE?: unknown;
};
declare global {
interface Window {
REACT_UTILS_INJECTION?: InjT;
}
}
export interface SsrContextT<StateT> extends SsrContext<StateT> {
chunkGroups: ChunkGroupsT;
chunks: string[];
/** If set at the end of SSR, the rendered will trigger
* server-side redirect to this URL (and use the status
* code). */
redirectTo?: string;
req: Request;
status: number;
}
declare const getSsrContext: (throwWithoutSsrContext?: boolean) => SsrContextT<unknown> | undefined;
export { getSsrContext, };