diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 98bb0ee676e5d..d151daf0f7985 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1040,17 +1040,40 @@ interface JSON { /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. + * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; + stringify( + value: number | string | boolean | null | object, + replacer?: (number | string)[] | null, + space?: string | number + ): string; + stringify( + value: undefined | Symbol, + replacer?: (number | string)[] | null, + space?: any + ): undefined; + stringify( + value: any, + replacer?: (number | string)[] | null, + space?: string | number + ): any; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; + stringify( + value: any, + replacer: (this: any, key: string, value: any) => number | string | boolean | null | object, + space?: string | number + ): string; + stringify( + value: any, + replacer?: (this: any, key: string, value: any) => any, + space?: string | number + ): any; } /** diff --git a/tests/baselines/reference/controlFlowPropertyDeclarations.symbols b/tests/baselines/reference/controlFlowPropertyDeclarations.symbols index a4b343f9ccbe1..cebac6f6f587b 100644 --- a/tests/baselines/reference/controlFlowPropertyDeclarations.symbols +++ b/tests/baselines/reference/controlFlowPropertyDeclarations.symbols @@ -232,9 +232,9 @@ export class HTMLtoJSX { >whitespace : Symbol(whitespace, Decl(controlFlowPropertyDeclarations.ts, 121, 50)) return '{' + JSON.stringify(whitespace) + '}'; ->JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >whitespace : Symbol(whitespace, Decl(controlFlowPropertyDeclarations.ts, 121, 50)) }); diff --git a/tests/baselines/reference/controlFlowPropertyDeclarations.types b/tests/baselines/reference/controlFlowPropertyDeclarations.types index d1b74c8feb7bf..b4fe67050db39 100644 --- a/tests/baselines/reference/controlFlowPropertyDeclarations.types +++ b/tests/baselines/reference/controlFlowPropertyDeclarations.types @@ -316,9 +316,9 @@ export class HTMLtoJSX { >'{' + JSON.stringify(whitespace) : string >'{' : "{" >JSON.stringify(whitespace) : string ->JSON.stringify : { (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } +>JSON.stringify : { (value: string | number | boolean | object, replacer?: (string | number)[], space?: string | number): string; (value: Symbol, replacer?: (string | number)[], space?: any): undefined; (value: any, replacer?: (string | number)[], space?: string | number): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object, space?: string | number): string; (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): any; } >JSON : JSON ->stringify : { (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } +>stringify : { (value: string | number | boolean | object, replacer?: (string | number)[], space?: string | number): string; (value: Symbol, replacer?: (string | number)[], space?: any): undefined; (value: any, replacer?: (string | number)[], space?: string | number): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object, space?: string | number): string; (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): any; } >whitespace : string >'}' : "}" diff --git a/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.symbols b/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.symbols index 8ae1b56e20fe7..674159af8a415 100644 --- a/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.symbols +++ b/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.symbols @@ -51,9 +51,9 @@ const Child: SFC = ({ }) => `name: ${name} props: ${JSON.stringify(props)}`; >name : Symbol(name, Decl(destructuringInitializerContextualTypeFromContext.ts, 15, 13)) ->JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >props : Symbol(props, Decl(destructuringInitializerContextualTypeFromContext.ts, 16, 21)) // Repro from #29189 diff --git a/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.types b/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.types index d0ddb4918a034..90df9fc8aac86 100644 --- a/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.types +++ b/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.types @@ -50,9 +50,9 @@ const Child: SFC = ({ >`name: ${name} props: ${JSON.stringify(props)}` : string >name : "Apollo" | "Artemis" | "Dionysus" | "Persephone" >JSON.stringify(props) : string ->JSON.stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >JSON : JSON ->stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >props : {} // Repro from #29189 diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index e7e55ca0e1a5d..098516bcea408 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -41,7 +41,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'? -!!! related TS2728 /.ts/lib.es5.d.ts:1415:13: 'Array' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1438:13: 'Array' is declared here. a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]] ~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type '[[any]]'. diff --git a/tests/baselines/reference/destructuringTuple.errors.txt b/tests/baselines/reference/destructuringTuple.errors.txt index 7b9785db0f198..7220cab4068e4 100644 --- a/tests/baselines/reference/destructuringTuple.errors.txt +++ b/tests/baselines/reference/destructuringTuple.errors.txt @@ -33,8 +33,8 @@ tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload mat !!! error TS2769: Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error. !!! error TS2769: Type 'never[]' is not assignable to type '[]'. !!! error TS2769: Target allows only 0 element(s) but source may have more. -!!! related TS6502 /.ts/lib.es5.d.ts:1380:24: The expected type comes from the return type of this signature. -!!! related TS6502 /.ts/lib.es5.d.ts:1386:27: The expected type comes from the return type of this signature. +!!! related TS6502 /.ts/lib.es5.d.ts:1403:24: The expected type comes from the return type of this signature. +!!! related TS6502 /.ts/lib.es5.d.ts:1409:27: The expected type comes from the return type of this signature. ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(...items: ConcatArray[]): never[]', gave the following error. diff --git a/tests/baselines/reference/json.stringify.js b/tests/baselines/reference/json.stringify.js index a37485bdfa28d..a5cea2ca58c49 100644 --- a/tests/baselines/reference/json.stringify.js +++ b/tests/baselines/reference/json.stringify.js @@ -1,15 +1,52 @@ //// [json.stringify.ts] +var anyReplacer = (k) => undefined; +var failsafeReplacer = (k) => null; var value = null; JSON.stringify(value, undefined, 2); JSON.stringify(value, null, 2); JSON.stringify(value, ["a", 1], 2); -JSON.stringify(value, (k) => undefined, 2); -JSON.stringify(value, undefined, 2); +JSON.stringify(value, anyReplacer, 2); +JSON.stringify(value, failsafeReplacer, 2); +JSON.stringify(value, undefined, 2); +JSON.stringify(undefined); +JSON.stringify(undefined, anyReplacer); +JSON.stringify(undefined, failsafeReplacer); +JSON.stringify(() => "", anyReplacer); +JSON.stringify(() => "", failsafeReplacer); +JSON.stringify({}); +JSON.stringify({}, anyReplacer); +JSON.stringify({}, failsafeReplacer); +JSON.stringify(new Object()); +JSON.stringify(new Object(), anyReplacer); +JSON.stringify(new Object(), failsafeReplacer); +var anyValue: any; +JSON.stringify(anyValue); +JSON.stringify(anyValue, anyReplacer); +JSON.stringify(anyValue, failsafeReplacer); + //// [json.stringify.js] +var anyReplacer = function (k) { return undefined; }; +var failsafeReplacer = function (k) { return null; }; var value = null; JSON.stringify(value, undefined, 2); JSON.stringify(value, null, 2); JSON.stringify(value, ["a", 1], 2); -JSON.stringify(value, function (k) { return undefined; }, 2); +JSON.stringify(value, anyReplacer, 2); +JSON.stringify(value, failsafeReplacer, 2); JSON.stringify(value, undefined, 2); +JSON.stringify(undefined); +JSON.stringify(undefined, anyReplacer); +JSON.stringify(undefined, failsafeReplacer); +JSON.stringify(function () { return ""; }, anyReplacer); +JSON.stringify(function () { return ""; }, failsafeReplacer); +JSON.stringify({}); +JSON.stringify({}, anyReplacer); +JSON.stringify({}, failsafeReplacer); +JSON.stringify(new Object()); +JSON.stringify(new Object(), anyReplacer); +JSON.stringify(new Object(), failsafeReplacer); +var anyValue; +JSON.stringify(anyValue); +JSON.stringify(anyValue, anyReplacer); +JSON.stringify(anyValue, failsafeReplacer); diff --git a/tests/baselines/reference/json.stringify.symbols b/tests/baselines/reference/json.stringify.symbols index 213e4a0e28ad3..ab2bc7f556512 100644 --- a/tests/baselines/reference/json.stringify.symbols +++ b/tests/baselines/reference/json.stringify.symbols @@ -1,38 +1,145 @@ === tests/cases/compiler/json.stringify.ts === +var anyReplacer = (k) => undefined; +>anyReplacer : Symbol(anyReplacer, Decl(json.stringify.ts, 0, 3)) +>k : Symbol(k, Decl(json.stringify.ts, 0, 19)) +>undefined : Symbol(undefined) + +var failsafeReplacer = (k) => null; +>failsafeReplacer : Symbol(failsafeReplacer, Decl(json.stringify.ts, 1, 3)) +>k : Symbol(k, Decl(json.stringify.ts, 1, 24)) + var value = null; ->value : Symbol(value, Decl(json.stringify.ts, 0, 3)) +>value : Symbol(value, Decl(json.stringify.ts, 2, 3)) JSON.stringify(value, undefined, 2); ->JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->value : Symbol(value, Decl(json.stringify.ts, 0, 3)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 2, 3)) >undefined : Symbol(undefined) JSON.stringify(value, null, 2); ->JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->value : Symbol(value, Decl(json.stringify.ts, 0, 3)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 2, 3)) JSON.stringify(value, ["a", 1], 2); ->JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->value : Symbol(value, Decl(json.stringify.ts, 0, 3)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 2, 3)) -JSON.stringify(value, (k) => undefined, 2); ->JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +JSON.stringify(value, anyReplacer, 2); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->value : Symbol(value, Decl(json.stringify.ts, 0, 3)) ->k : Symbol(k, Decl(json.stringify.ts, 4, 23)) ->undefined : Symbol(undefined) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 2, 3)) +>anyReplacer : Symbol(anyReplacer, Decl(json.stringify.ts, 0, 3)) + +JSON.stringify(value, failsafeReplacer, 2); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 2, 3)) +>failsafeReplacer : Symbol(failsafeReplacer, Decl(json.stringify.ts, 1, 3)) JSON.stringify(value, undefined, 2); ->JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->value : Symbol(value, Decl(json.stringify.ts, 0, 3)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 2, 3)) >undefined : Symbol(undefined) +JSON.stringify(undefined); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +JSON.stringify(undefined, anyReplacer); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) +>anyReplacer : Symbol(anyReplacer, Decl(json.stringify.ts, 0, 3)) + +JSON.stringify(undefined, failsafeReplacer); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) +>failsafeReplacer : Symbol(failsafeReplacer, Decl(json.stringify.ts, 1, 3)) + +JSON.stringify(() => "", anyReplacer); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>anyReplacer : Symbol(anyReplacer, Decl(json.stringify.ts, 0, 3)) + +JSON.stringify(() => "", failsafeReplacer); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>failsafeReplacer : Symbol(failsafeReplacer, Decl(json.stringify.ts, 1, 3)) + +JSON.stringify({}); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +JSON.stringify({}, anyReplacer); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>anyReplacer : Symbol(anyReplacer, Decl(json.stringify.ts, 0, 3)) + +JSON.stringify({}, failsafeReplacer); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>failsafeReplacer : Symbol(failsafeReplacer, Decl(json.stringify.ts, 1, 3)) + +JSON.stringify(new Object()); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +JSON.stringify(new Object(), anyReplacer); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>anyReplacer : Symbol(anyReplacer, Decl(json.stringify.ts, 0, 3)) + +JSON.stringify(new Object(), failsafeReplacer); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>failsafeReplacer : Symbol(failsafeReplacer, Decl(json.stringify.ts, 1, 3)) + +var anyValue: any; +>anyValue : Symbol(anyValue, Decl(json.stringify.ts, 20, 3)) + +JSON.stringify(anyValue); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>anyValue : Symbol(anyValue, Decl(json.stringify.ts, 20, 3)) + +JSON.stringify(anyValue, anyReplacer); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>anyValue : Symbol(anyValue, Decl(json.stringify.ts, 20, 3)) +>anyReplacer : Symbol(anyReplacer, Decl(json.stringify.ts, 0, 3)) + +JSON.stringify(anyValue, failsafeReplacer); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>anyValue : Symbol(anyValue, Decl(json.stringify.ts, 20, 3)) +>failsafeReplacer : Symbol(failsafeReplacer, Decl(json.stringify.ts, 1, 3)) + diff --git a/tests/baselines/reference/json.stringify.types b/tests/baselines/reference/json.stringify.types index 44f7636d46afc..624ab67360af8 100644 --- a/tests/baselines/reference/json.stringify.types +++ b/tests/baselines/reference/json.stringify.types @@ -1,54 +1,189 @@ === tests/cases/compiler/json.stringify.ts === +var anyReplacer = (k) => undefined; +>anyReplacer : (k: any) => undefined +>(k) => undefined : (k: any) => undefined +>k : any +>undefined : undefined + +var failsafeReplacer = (k) => null; +>failsafeReplacer : (k: any) => null +>(k) => null : (k: any) => null +>k : any +>null : null + var value = null; >value : null >null : null JSON.stringify(value, undefined, 2); >JSON.stringify(value, undefined, 2) : string ->JSON.stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >JSON : JSON ->stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >value : null >undefined : undefined >2 : 2 JSON.stringify(value, null, 2); >JSON.stringify(value, null, 2) : string ->JSON.stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >JSON : JSON ->stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >value : null >null : null >2 : 2 JSON.stringify(value, ["a", 1], 2); >JSON.stringify(value, ["a", 1], 2) : string ->JSON.stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >JSON : JSON ->stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >value : null >["a", 1] : (string | number)[] >"a" : "a" >1 : 1 >2 : 2 -JSON.stringify(value, (k) => undefined, 2); ->JSON.stringify(value, (k) => undefined, 2) : string ->JSON.stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +JSON.stringify(value, anyReplacer, 2); +>JSON.stringify(value, anyReplacer, 2) : any +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >JSON : JSON ->stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >value : null ->(k) => undefined : (this: any, k: string) => undefined ->k : string ->undefined : undefined +>anyReplacer : (k: any) => undefined +>2 : 2 + +JSON.stringify(value, failsafeReplacer, 2); +>JSON.stringify(value, failsafeReplacer, 2) : string +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>value : null +>failsafeReplacer : (k: any) => null >2 : 2 JSON.stringify(value, undefined, 2); >JSON.stringify(value, undefined, 2) : string ->JSON.stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >JSON : JSON ->stringify : { (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } >value : null >undefined : undefined >2 : 2 +JSON.stringify(undefined); +>JSON.stringify(undefined) : undefined +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>undefined : undefined + +JSON.stringify(undefined, anyReplacer); +>JSON.stringify(undefined, anyReplacer) : any +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>undefined : undefined +>anyReplacer : (k: any) => undefined + +JSON.stringify(undefined, failsafeReplacer); +>JSON.stringify(undefined, failsafeReplacer) : string +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>undefined : undefined +>failsafeReplacer : (k: any) => null + +JSON.stringify(() => "", anyReplacer); +>JSON.stringify(() => "", anyReplacer) : any +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>() => "" : () => string +>"" : "" +>anyReplacer : (k: any) => undefined + +JSON.stringify(() => "", failsafeReplacer); +>JSON.stringify(() => "", failsafeReplacer) : string +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>() => "" : () => string +>"" : "" +>failsafeReplacer : (k: any) => null + +JSON.stringify({}); +>JSON.stringify({}) : string +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>{} : {} + +JSON.stringify({}, anyReplacer); +>JSON.stringify({}, anyReplacer) : any +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>{} : {} +>anyReplacer : (k: any) => undefined + +JSON.stringify({}, failsafeReplacer); +>JSON.stringify({}, failsafeReplacer) : string +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>{} : {} +>failsafeReplacer : (k: any) => null + +JSON.stringify(new Object()); +>JSON.stringify(new Object()) : string +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>new Object() : Object +>Object : ObjectConstructor + +JSON.stringify(new Object(), anyReplacer); +>JSON.stringify(new Object(), anyReplacer) : any +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>new Object() : Object +>Object : ObjectConstructor +>anyReplacer : (k: any) => undefined + +JSON.stringify(new Object(), failsafeReplacer); +>JSON.stringify(new Object(), failsafeReplacer) : string +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>new Object() : Object +>Object : ObjectConstructor +>failsafeReplacer : (k: any) => null + +var anyValue: any; +>anyValue : any + +JSON.stringify(anyValue); +>JSON.stringify(anyValue) : any +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>anyValue : any + +JSON.stringify(anyValue, anyReplacer); +>JSON.stringify(anyValue, anyReplacer) : any +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>anyValue : any +>anyReplacer : (k: any) => undefined + +JSON.stringify(anyValue, failsafeReplacer); +>JSON.stringify(anyValue, failsafeReplacer) : string +>JSON.stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>JSON : JSON +>stringify : { (value: string | number | boolean | object | null, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; (value: Symbol | undefined, replacer?: (string | number)[] | null | undefined, space?: any): undefined; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object | null, space?: string | number | undefined): string; (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): any; } +>anyValue : any +>failsafeReplacer : (k: any) => null + diff --git a/tests/baselines/reference/parserharness.symbols b/tests/baselines/reference/parserharness.symbols index 85fcd37d626ee..04ebeafa7857b 100644 --- a/tests/baselines/reference/parserharness.symbols +++ b/tests/baselines/reference/parserharness.symbols @@ -5490,9 +5490,9 @@ module Harness { >getHostSettings : Symbol(TypeScriptLS.getHostSettings, Decl(parserharness.ts, 1836, 9)) return JSON.stringify({ usePullLanguageService: usePull }); ->JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >usePullLanguageService : Symbol(usePullLanguageService, Decl(parserharness.ts, 1839, 35)) >usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14)) } diff --git a/tests/baselines/reference/parserharness.types b/tests/baselines/reference/parserharness.types index 747a041f87bc3..7520639cb91b3 100644 --- a/tests/baselines/reference/parserharness.types +++ b/tests/baselines/reference/parserharness.types @@ -7548,10 +7548,10 @@ module Harness { >getHostSettings : () => string return JSON.stringify({ usePullLanguageService: usePull }); ->JSON.stringify({ usePullLanguageService: usePull }) : string ->JSON.stringify : { (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } +>JSON.stringify({ usePullLanguageService: usePull }) : any +>JSON.stringify : { (value: string | number | boolean | object, replacer?: (string | number)[], space?: string | number): string; (value: Symbol, replacer?: (string | number)[], space?: any): undefined; (value: any, replacer?: (string | number)[], space?: string | number): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object, space?: string | number): string; (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): any; } >JSON : JSON ->stringify : { (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } +>stringify : { (value: string | number | boolean | object, replacer?: (string | number)[], space?: string | number): string; (value: Symbol, replacer?: (string | number)[], space?: any): undefined; (value: any, replacer?: (string | number)[], space?: string | number): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object, space?: string | number): string; (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): any; } >{ usePullLanguageService: usePull } : { usePullLanguageService: boolean; } >usePullLanguageService : boolean >usePull : boolean diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index bcceb3790cc37..d9d15e6627dcd 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -447,7 +447,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2769: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1460:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1483:5: 'catch' is declared here. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index 053bc3c1a8751..eef6e64e455b7 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -351,7 +351,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of ~~~~~~~~~ !!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1460:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1483:5: 'catch' is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index 3303c1e3a094b..ccc9c214443cf 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -398,7 +398,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2769: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1460:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1483:5: 'catch' is declared here. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok @@ -445,5 +445,5 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (x: T): IPromise; (x: T, y: T): Promise; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1460:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1483:5: 'catch' is declared here. var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok \ No newline at end of file diff --git a/tests/baselines/reference/redefineArray.errors.txt b/tests/baselines/reference/redefineArray.errors.txt index e59c0e9e24a1c..60e6330af12fc 100644 --- a/tests/baselines/reference/redefineArray.errors.txt +++ b/tests/baselines/reference/redefineArray.errors.txt @@ -5,4 +5,4 @@ tests/cases/compiler/redefineArray.ts(1,1): error TS2741: Property 'isArray' is Array = function (n:number, s:string) {return n;}; ~~~~~ !!! error TS2741: Property 'isArray' is missing in type '(n: number, s: string) => number' but required in type 'ArrayConstructor'. -!!! related TS2728 /.ts/lib.es5.d.ts:1411:5: 'isArray' is declared here. \ No newline at end of file +!!! related TS2728 /.ts/lib.es5.d.ts:1434:5: 'isArray' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.symbols b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.symbols index 5bcfebca97ce8..f8af855f15d28 100644 --- a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.symbols +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.symbols @@ -562,9 +562,9 @@ class ListWrapper { >ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) >l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 113, 43)) >T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 113, 16)) ->JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 113, 43)) static maximum(dit: typeof ListWrapper, list: T[], predicate: (t: T) => number): T { diff --git a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types index cd907c26ec802..61bf4eed15cce 100644 --- a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types @@ -594,9 +594,9 @@ class ListWrapper { >ListWrapper : typeof ListWrapper >l : T[] >JSON.stringify(l) : string ->JSON.stringify : { (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } +>JSON.stringify : { (value: string | number | boolean | object, replacer?: (string | number)[], space?: string | number): string; (value: Symbol, replacer?: (string | number)[], space?: any): undefined; (value: any, replacer?: (string | number)[], space?: string | number): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object, space?: string | number): string; (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): any; } >JSON : JSON ->stringify : { (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } +>stringify : { (value: string | number | boolean | object, replacer?: (string | number)[], space?: string | number): string; (value: Symbol, replacer?: (string | number)[], space?: any): undefined; (value: any, replacer?: (string | number)[], space?: string | number): any; (value: any, replacer: (this: any, key: string, value: any) => string | number | boolean | object, space?: string | number): string; (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): any; } >l : T[] static maximum(dit: typeof ListWrapper, list: T[], predicate: (t: T) => number): T { diff --git a/tests/cases/compiler/json.stringify.ts b/tests/cases/compiler/json.stringify.ts index 58400f859df60..92f4fa4ac6466 100644 --- a/tests/cases/compiler/json.stringify.ts +++ b/tests/cases/compiler/json.stringify.ts @@ -1,8 +1,26 @@ // @strictNullChecks: true +var anyReplacer = (k) => undefined; +var failsafeReplacer = (k) => null; var value = null; JSON.stringify(value, undefined, 2); JSON.stringify(value, null, 2); JSON.stringify(value, ["a", 1], 2); -JSON.stringify(value, (k) => undefined, 2); -JSON.stringify(value, undefined, 2); \ No newline at end of file +JSON.stringify(value, anyReplacer, 2); +JSON.stringify(value, failsafeReplacer, 2); +JSON.stringify(value, undefined, 2); +JSON.stringify(undefined); +JSON.stringify(undefined, anyReplacer); +JSON.stringify(undefined, failsafeReplacer); +JSON.stringify(() => "", anyReplacer); +JSON.stringify(() => "", failsafeReplacer); +JSON.stringify({}); +JSON.stringify({}, anyReplacer); +JSON.stringify({}, failsafeReplacer); +JSON.stringify(new Object()); +JSON.stringify(new Object(), anyReplacer); +JSON.stringify(new Object(), failsafeReplacer); +var anyValue: any; +JSON.stringify(anyValue); +JSON.stringify(anyValue, anyReplacer); +JSON.stringify(anyValue, failsafeReplacer);