total-typescript / ts-reset

A 'CSS reset' for TypeScript, improving types for common JavaScript API's
https://www.totaltypescript.com/ts-reset
MIT License
7.74k stars 117 forks source link

fix: JSON.parse accepting null #174

Open ImLunaHey opened 9 months ago

ImLunaHey commented 9 months ago

Please let me know if I missed anything in this.

Fixes: https://github.com/total-typescript/ts-reset/issues/173

qb20nh commented 6 months ago

Argument name should not change.

ImLunaHey commented 6 months ago

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

qb20nh commented 6 months ago

That is not a typescript issue.

qb20nh commented 6 months ago

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