-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
π Search Terms
"JSON.stringify()"
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about "JSON.stringify()`
β― Playground Link
π» Code
const foo = JSON.stringify(undefined);
foo.startsWith("I'm crashing on runtime, uoooh oooh oooh");π Actual behavior
The foo variable is typed as string
π Expected behavior
the foo variable is typed as undefined
Additional information about the issue
I think this should be relatively easy to fix with the following overload
interface JSON {
// ...
stringify(value: undefined, replacer?: (number | string)[] | null, space?: string | number): undefined;
}But such a change will probably start throwing compilation errors in the wild.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created