Skip to content

Commit

Permalink
Use generic type for vnode props in renderToReadableStream/renderToPi…
Browse files Browse the repository at this point in the history
…peableStream (#409)

* use generic type for vnode props in renderToReadableStream/renderToPipeableStream, similar to other render functions

* Update .changeset/little-rocks-doubt.md

---------

Co-authored-by: Jovi De Croock <[email protected]>
  • Loading branch information
f0x52 and JoviDeCroock authored Jan 10, 2025
1 parent 2da38a7 commit 2afaf31
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-rocks-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'preact-render-to-string': patch
---

Ensure the renderToStream types of `/stream` and `/stream-node` accept a generic for the props of the passed in VNode
4 changes: 2 additions & 2 deletions src/stream-node.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ interface PipeableStream {
pipe: (writable: WritableStream) => void;
}

export function renderToPipeableStream(
vnode: VNode,
export function renderToPipeableStream<P = {}>(
vnode: VNode<P>,
options: RenderToPipeableStreamOptions,
context?: any
): PipeableStream;
4 changes: 2 additions & 2 deletions src/stream.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface RenderStream extends ReadableStream<Uint8Array> {
allReady: Promise<void>;
}

export function renderToReadableStream(
vnode: VNode,
export function renderToReadableStream<P = {}>(
vnode: VNode<P>,
context?: any
): RenderStream;

0 comments on commit 2afaf31

Please sign in to comment.