Skip to content

Commit ef79a84

Browse files
committed
Fix tests
1 parent 1231a8e commit ef79a84

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

types/react-dom/server.d.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,40 @@ declare global {
44
// tslint:disable-next-line:no-empty-interface
55
interface ReadableStream {}
66

7+
// tslint:disable-next-line:no-empty-interface
78
interface WritableStream {}
89
}
910

11+
/**
12+
* Stub for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
13+
*/
14+
// tslint:disable-next-line:no-empty-interface
15+
interface AbortSignal {}
16+
1017
/**
1118
* Stub for https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
1219
*/
20+
// tslint:disable-next-line:no-empty-interface
1321
interface ReadableStream {}
1422
}
1523

1624
import { ReactElement, ReactNode } from 'react';
1725

18-
interface RenderToPipeableStreamOptions {
26+
export interface RenderToPipeableStreamOptions {
1927
identifierPrefix?: string;
2028
namespaceURI?: string;
2129
nonce?: string;
2230
bootstrapScriptContent?: string;
23-
bootstrapScripts?: Array<string>;
24-
bootstrapModules?: Array<string>;
31+
bootstrapScripts?: string[];
32+
bootstrapModules?: string[];
2533
progressiveChunkSize?: number;
2634
onShellReady?: () => void;
2735
onShellError?: (error: unknown) => void;
2836
onAllReady?: () => void;
2937
onError?: (error: unknown) => void;
3038
}
3139

32-
interface PipeableStream {
40+
export interface PipeableStream {
3341
abort(): void;
3442
pipe<Writable extends NodeJS.WritableStream>(destination: Writable): Writable;
3543
}
@@ -80,19 +88,19 @@ export function renderToStaticMarkup(element: ReactElement): string;
8088
*/
8189
export function renderToStaticNodeStream(element: ReactElement): NodeJS.ReadableStream;
8290

83-
interface RenderToReadableStreamOptions {
91+
export interface RenderToReadableStreamOptions {
8492
identifierPrefix?: string;
8593
namespaceURI?: string;
8694
nonce?: string;
8795
bootstrapScriptContent?: string;
88-
bootstrapScripts?: Array<string>;
89-
bootstrapModules?: Array<string>;
96+
bootstrapScripts?: string[];
97+
bootstrapModules?: string[];
9098
progressiveChunkSize?: number;
9199
signal?: AbortSignal;
92100
onError?: (error: unknown) => void;
93101
}
94102

95-
interface ReactDOMServerReadableStream extends ReadableStream {
103+
export interface ReactDOMServerReadableStream extends ReadableStream {
96104
allReady: Promise<void>;
97105
}
98106

types/react-dom/test/react-dom-tests.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ function pipeableStreamDocumentedExample() {
265265
}
266266

267267
let didError = false;
268-
const res = {} as Response;
268+
const res: Response = {} as any;
269269
const stream = ReactDOMServer.renderToPipeableStream(<App />, {
270270
onShellReady() {
271271
res.statusCode = didError ? 500 : 200;
@@ -288,10 +288,10 @@ function pipeableStreamDocumentedExample() {
288288
* source: https://reactjs.org/docs/react-dom-server.html#rendertoreadablestream
289289
*/
290290
async function readableStreamDocumentedExample() {
291-
let controller = new AbortController();
291+
const controller = new AbortController();
292292
let didError = false;
293293
try {
294-
let stream = await ReactDOMServer.renderToReadableStream(
294+
const stream = await ReactDOMServer.renderToReadableStream(
295295
<html>
296296
<body>Success</body>
297297
</html>,

0 commit comments

Comments
 (0)