fix(stream-transform): accept options after handler in types - #507
Open
JaylinZhou88 wants to merge 1 commit into
Open
JaylinZhou88 wants to merge 1 commit into
JaylinZhou88 wants to merge 1 commit into
Conversation
Assisted-by: OpenAI Codex
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.
transform(handler, options)works in JavaScript, including the stream-pipe recipe, but TypeScript rejects the options object as a callback. The same mismatch affectstransform(records, handler, options)in the callback and promise samples.Add overloads for options after the handler, with and without input records, retaining the optional completion callback. Synchronize the CJS and browser declaration copies. Runtime behavior is unchanged.
Related to #348; the original report does not specify whether it used TypeScript, so this addresses the independently reproduced declaration mismatch rather than claiming to resolve every possible cause of that report.
Validation on Windows, Node 24.19.0:
tsc --noEmit: passed forpackages/stream-transform.test/samples.js: 68 passed, including both new behavior tests.git diff --check: passed for the change.The unmodified package test command encounters existing Windows harness issues: cmd.exe preserves the single quotes around the Mocha glob, and
test/samples.jsconstructs a Windows path from URL.pathname. The equivalent checks above avoid those harness problems; the harness itself is unchanged.AI disclosure: OpenAI Codex prepared this patch, reviewed the diff, and executed the local validation. This contribution is submitted on behalf of the account owner; it does not claim independent human code review.