Skip to content

Commit 4e92059

Browse files
committed
fix stream-node writable type
1 parent dd5a55d commit 4e92059

5 files changed

Lines changed: 24 additions & 12 deletions

File tree

.changeset/fuzzy-streams-write.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"preact-render-to-string": patch
3+
---
4+
5+
Use Node's `Writable` type for `renderToPipeableStream` destinations.

package-lock.json

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
"@changesets/changelog-github": "^1.0.0",
116116
"@changesets/cli": "^3.0.0",
117117
"@preact/signals-core": "^1.11.0",
118+
"@types/node": "^20.19.43",
118119
"baseline-rts": "npm:preact-render-to-string@latest",
119120
"benchmarkjs-pretty": "^2.0.1",
120121
"check-export-map": "^1.3.1",

src/stream-node.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { VNode } from 'preact';
2-
import { WritableStream } from 'node:stream';
2+
import { Writable } from 'node:stream';
33

44
interface RenderToPipeableStreamOptions {
55
nonce?: string;
@@ -10,7 +10,7 @@ interface RenderToPipeableStreamOptions {
1010

1111
interface PipeableStream {
1212
abort: (reason?: unknown) => void;
13-
pipe: (writable: WritableStream) => void;
13+
pipe: (writable: Writable) => void;
1414
}
1515

1616
export function renderToPipeableStream<P = {}>(

tsconfig.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@
1010
"strictFunctionTypes": true,
1111
"baseUrl": "../",
1212
"typeRoots": [
13-
"../"
13+
"../",
14+
"./node_modules/@types"
1415
],
1516
"jsx": "react",
1617
"jsxFactory": "h",
17-
"types": [],
18+
"types": [
19+
"node"
20+
],
1821
"noEmit": true,
1922
"forceConsistentCasingInFileNames": true
2023
},
2124
"files": [
22-
"src/index.d.ts"
25+
"src/index.d.ts",
26+
"src/stream.d.ts",
27+
"src/stream-node.d.ts"
2328
]
2429
}

0 commit comments

Comments
 (0)