-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #367 from preactjs/fix/stream-types
fix: Add types for renderStream & pipeableStream
- Loading branch information
Showing
7 changed files
with
75 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'preact-render-to-string': patch | ||
--- | ||
|
||
Add types for `/stream` and `/stream-node` exports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { VNode } from 'preact'; | ||
import { WritableStream } from 'node:stream'; | ||
|
||
interface RenderToPipeableStreamOptions { | ||
onShellReady?: () => void; | ||
onAllReady?: () => void; | ||
onError?: (error: any) => void; | ||
} | ||
|
||
interface PipeableStream { | ||
abort: () => void; | ||
pipe: (writable: WritableStream) => void; | ||
} | ||
|
||
export function renderToReadableStream( | ||
vnode: VNode, | ||
options: RenderToPipeableStreamOptions, | ||
context?: any | ||
): PipeableStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { VNode } from 'preact'; | ||
|
||
interface RenderStream extends ReadableStream<Uint8Array> { | ||
allReady: Promise<void>; | ||
} | ||
|
||
export function renderToReadableStream( | ||
vnode: VNode, | ||
context?: any | ||
): RenderStream; |