Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: JSON.parse accepting null #174

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ImLunaHey
Copy link

Please let me know if I missed anything in this.

Fixes: #173

@qb20nh
Copy link

qb20nh commented Jan 23, 2024

Argument name should not change.

@ImLunaHey
Copy link
Author

ImLunaHey commented Jan 23, 2024

it should never have been called text to begin with. it's a value.

@qb20nh
Copy link

qb20nh commented Jan 24, 2024

That is not a typescript issue.

@qb20nh
Copy link

qb20nh commented Jan 25, 2024

For completeness and consistency, we should generalize to all valid JSON string producing text values.

parse<T extends boolean | number | bigint>(text: T, /*...*/): T
parse<T extends boolean | number | bigint | null>(text: T, /*...*/): unknown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow passing null to JSON.parse()
2 participants