fix(stringify): reject invalid values in cast option objects - #511
Merged
Merged
Conversation
Member
|
Hi @kirisue, could you provide me with the permission to push into your fork. I wish to update the tests. |
Contributor
Author
|
Hi @wdavidw, I've enabled “Allow edits by maintainers” for this PR. You should now be able to push the test updates directly to the branch. Thanks for taking a look! |
wdavidw
force-pushed
the
fix/stringify-cast-option-value
branch
from
September 30, 2026 13:24
af28eb1 to
44f53d8
Compare
Member
|
Thank you @kirisue for your involvement. |
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.
csv-stringifysilently writes an empty field when a custom cast returns an options object whosevalueis0orfalse:The existing type guard allows only strings, null and undefined, but an unrelated
if (err)prevents it from reporting the invalid value. Remove that condition so invalid values are rejected before formatting. Valid string, null and undefined values retain their existing behavior.Add regression cases for 0 and false in both the callback and synchronous public APIs, plus a control covering the allowed value types. Unsupported truthy values are also rejected by this earlier guard and now receive its Invalid Casting Value message rather than the later Formatter message.
Validation on Node.js 24.19.0:
npm test --workspace csv-stringify: TypeScript check passed; 232 tests passed, 1 pre-existing pending test.Prepared with OpenAI Codex; the listed tests were executed locally.