fix(image,react-pdf): resolve Buffer/stream type errors breaking build - #304
Open
ctate wants to merge 1 commit into
Open
fix(image,react-pdf): resolve Buffer/stream type errors breaking build#304ctate wants to merge 1 commit into
ctate wants to merge 1 commit into
Conversation
@resvg/resvg-js's asPng() and @react-pdf/renderer's renderToBuffer() return Node Buffer, which no longer satisfies the declared Uint8Array return types under the current @types/node/TypeScript resolution, failing dts builds (and therefore the release workflow's build step). Wrap the Buffers in zero-copy Uint8Array views. renderToStream() was declared as returning a web ReadableStream, but @react-pdf/renderer's renderToStream() actually resolves to a NodeJS.ReadableStream; declare what it really returns.
Contributor
Open
| spec: Spec, | ||
| options?: RenderOptions, | ||
| ): Promise<ReadableStream> { | ||
| ): Promise<NodeJS.ReadableStream> { |
Contributor
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@json-render/imageand@json-render/react-pdfcurrently failbuild(dts) andcheck-typeson main:Since the release workflow's publish job runs
pnpm run build, this blocks the next release.Fix
renderToPng/renderToBuffer:@resvg/resvg-js'sasPng()and@react-pdf/renderer'srenderToBuffer()return NodeBuffer; wrap in zero-copyUint8Arrayviews to satisfy the declared platform-neutral return types.renderToStream: was declaredPromise<ReadableStream>(web), but@react-pdf/renderer'srenderToStream()actually resolves to aNodeJS.ReadableStream. Declare what it really returns — treating the old type as a web stream would fail at runtime.Verification
All 24 package builds pass and 1021/1021 unit tests pass on this branch; both failures reproduce on unmodified main.