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

JSON.stringify(undefined) is not a string, but Typescript only defines the return type of string #40296

Closed
huboshu0819 opened this issue Aug 28, 2020 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@huboshu0819
Copy link

huboshu0819 commented Aug 28, 2020

TypeScript Version: 3.7.5

Search Terms:

Code

JSON.stringify(undefined).replace(/aa/ig, '');

**Expected behavior: typescript should prompt a type error

**Actual behavior: No error message

Playground Link:

Related Issues:

@huboshu0819 huboshu0819 changed the title JSON.stringify(undefined) is not a string JSON.stringify(undefined) is not a string, but Typescript only defines the return type of string Aug 28, 2020
@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Aug 28, 2020
@RyanCavanaugh
Copy link
Member

Duplicate #18879

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants