ts-reset icon indicating copy to clipboard operation
ts-reset copied to clipboard

fix: JSON.parse accepting null

Open ImLunaHey opened this issue 2 years ago • 4 comments

Please let me know if I missed anything in this.

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

ImLunaHey avatar Oct 18 '23 01:10 ImLunaHey

Argument name should not change.

qb20nh avatar Jan 23 '24 16:01 qb20nh

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

ImLunaHey avatar Jan 23 '24 21:01 ImLunaHey

That is not a typescript issue.

qb20nh avatar Jan 24 '24 06:01 qb20nh

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

qb20nh avatar Jan 25 '24 10:01 qb20nh