Skip to content

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

@dchest

Description

@dchest

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?

Metadata

Metadata

Assignees

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