Skip to content

Commit f5a20ce

Browse files
authored
Fix type of React bootstrapScripts and bootstrapModules (DefinitelyTyped#72335)
1 parent 798a9dc commit f5a20ce

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

types/react-dom/server.d.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,19 @@ declare global {
2424
import { ReactNode } from "react";
2525
import { ErrorInfo } from "./client";
2626

27+
export type BootstrapScriptDescriptor = {
28+
src: string,
29+
integrity?: string | undefined,
30+
crossOrigin?: string | undefined,
31+
};
32+
2733
export interface RenderToPipeableStreamOptions {
2834
identifierPrefix?: string;
2935
namespaceURI?: string;
3036
nonce?: string;
3137
bootstrapScriptContent?: string;
32-
bootstrapScripts?: string[];
33-
bootstrapModules?: string[];
38+
bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
39+
bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
3440
progressiveChunkSize?: number;
3541
onShellReady?: () => void;
3642
onShellError?: (error: unknown) => void;
@@ -82,8 +88,8 @@ export interface RenderToReadableStreamOptions {
8288
namespaceURI?: string;
8389
nonce?: string;
8490
bootstrapScriptContent?: string;
85-
bootstrapScripts?: string[];
86-
bootstrapModules?: string[];
91+
bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
92+
bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
8793
progressiveChunkSize?: number;
8894
signal?: AbortSignal;
8995
onError?: (error: unknown, errorInfo: ErrorInfo) => string | void;

types/react-dom/v18/server.d.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ declare global {
2424
import { ReactNode } from "react";
2525
import { ErrorInfo } from "./client";
2626

27+
export type BootstrapScriptDescriptor = {
28+
src: string,
29+
integrity?: string | undefined,
30+
crossOrigin?: string | undefined,
31+
};
2732
export interface RenderToPipeableStreamOptions {
2833
identifierPrefix?: string;
2934
namespaceURI?: string;
3035
nonce?: string;
3136
bootstrapScriptContent?: string;
32-
bootstrapScripts?: string[];
33-
bootstrapModules?: string[];
37+
bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
38+
bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
3439
progressiveChunkSize?: number;
3540
onShellReady?: () => void;
3641
onShellError?: (error: unknown) => void;
@@ -100,8 +105,8 @@ export interface RenderToReadableStreamOptions {
100105
namespaceURI?: string;
101106
nonce?: string;
102107
bootstrapScriptContent?: string;
103-
bootstrapScripts?: string[];
104-
bootstrapModules?: string[];
108+
bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
109+
bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
105110
progressiveChunkSize?: number;
106111
signal?: AbortSignal;
107112
onError?: (error: unknown, errorInfo: ErrorInfo) => string | void;

0 commit comments

Comments
 (0)