Skip to content

JSON.stringify without replacer with --strictNullChecks is not available #8729

Description

TypeScript Version:

nightly (1.9.0-dev.20160521.01)

Code

Currently JSON.stringify is defined as:

stringify(value: any): string;
stringify(value: any, replacer: (key: string, value: any) => any): string;
stringify(value: any, replacer: any[]): string;
stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string;
stringify(value: any, replacer: any[], space: string | number): string;

which makes it impossible to provide space argument without replacer if strictNullChecks is on:

JSON.stringify(value, undefined, 2)

Perhaps, another signature can be added or replacer can be made | undefined?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions