From 4b7f389e9dc90c83288bc7976ecc4d82ba54010a Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 7 Dec 2017 14:51:31 -0800 Subject: [PATCH 1/3] Add stricter parameter types for Object.values and Object.entries --- src/lib/es2017.object.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/es2017.object.d.ts b/src/lib/es2017.object.d.ts index 4014e8c29278a..cf15a8b558a73 100644 --- a/src/lib/es2017.object.d.ts +++ b/src/lib/es2017.object.d.ts @@ -3,25 +3,25 @@ interface ObjectConstructor { * Returns an array of values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - values(o: { [s: string]: T } | { [n: number]: T }): T[]; + values(o: { [s: string]: T } | { [n: number]: T } | boolean | number | string | symbol): T[]; /** * Returns an array of values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - values(o: any): any[]; + values(o: {}): any[]; /** * Returns an array of key/values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - entries(o: { [s: string]: T } | { [n: number]: T }): [string, T][]; + entries(o: { [s: string]: T } | { [n: number]: T } | boolean | number | string | symbol): [string, T][]; /** * Returns an array of key/values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - entries(o: any): [string, any][]; + entries(o: {}): [string, any][]; /** * Returns an object containing all own property descriptors of an object From 8a045b7029513674af891ee3619f294434e43876 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 8 Dec 2017 09:31:22 -0800 Subject: [PATCH 2/3] Use mapped type and constrain 'T extends object' --- src/lib/es2017.object.d.ts | 15 ++------ .../useObjectValuesAndEntries1.errors.txt | 17 +++++++++ .../reference/useObjectValuesAndEntries1.js | 16 ++++----- .../useObjectValuesAndEntries1.symbols | 28 +++++++-------- .../useObjectValuesAndEntries1.types | 36 +++++++++---------- .../useObjectValuesAndEntries4.symbols | 8 ++--- .../useObjectValuesAndEntries4.types | 8 ++--- .../es2017/useObjectValuesAndEntries1.ts | 8 ++--- 8 files changed, 71 insertions(+), 65 deletions(-) create mode 100644 tests/baselines/reference/useObjectValuesAndEntries1.errors.txt diff --git a/src/lib/es2017.object.d.ts b/src/lib/es2017.object.d.ts index cf15a8b558a73..ad9bd6533f6d8 100644 --- a/src/lib/es2017.object.d.ts +++ b/src/lib/es2017.object.d.ts @@ -3,25 +3,14 @@ interface ObjectConstructor { * Returns an array of values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - values(o: { [s: string]: T } | { [n: number]: T } | boolean | number | string | symbol): T[]; + values(o: T): T[keyof T][]; - /** - * Returns an array of values of the enumerable properties of an object - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - values(o: {}): any[]; - - /** - * Returns an array of key/values of the enumerable properties of an object - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - entries(o: { [s: string]: T } | { [n: number]: T } | boolean | number | string | symbol): [string, T][]; /** * Returns an array of key/values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - entries(o: {}): [string, any][]; + entries(o: T): [string, T[keyof T]][]; /** * Returns an object containing all own property descriptors of an object diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.errors.txt b/tests/baselines/reference/useObjectValuesAndEntries1.errors.txt new file mode 100644 index 0000000000000..1894f6d0400e0 --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries1.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts(8,31): error TS2345: Argument of type '1' is not assignable to parameter of type 'object'. + + +==== tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts (1 errors) ==== + var o = { a: 1, b: 2 }; + + for (var x of Object.values(o)) { + let y = x; + } + + var entries = Object.entries(o); + var entries1 = Object.entries(1); + ~ +!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'object'. + var entries2 = Object.entries({a: true, b: 2}) + var entries3 = Object.entries({}) + \ No newline at end of file diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.js b/tests/baselines/reference/useObjectValuesAndEntries1.js index c269e4f4c8e66..a10fb9a2d3267 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries1.js +++ b/tests/baselines/reference/useObjectValuesAndEntries1.js @@ -5,10 +5,10 @@ for (var x of Object.values(o)) { let y = x; } -var entries = Object.entries(o); // <-- entries: ['a' | 'b', number][] -var entries1 = Object.entries(1); // <-- entries: [string, any][] -var entries2 = Object.entries({a: true, b: 2}) // ['a' | 'b', number | boolean][] -var entries3 = Object.entries({}) // [never, any][] +var entries = Object.entries(o); +var entries1 = Object.entries(1); +var entries2 = Object.entries({a: true, b: 2}) +var entries3 = Object.entries({}) //// [useObjectValuesAndEntries1.js] @@ -17,7 +17,7 @@ for (var _i = 0, _a = Object.values(o); _i < _a.length; _i++) { var x = _a[_i]; var y = x; } -var entries = Object.entries(o); // <-- entries: ['a' | 'b', number][] -var entries1 = Object.entries(1); // <-- entries: [string, any][] -var entries2 = Object.entries({ a: true, b: 2 }); // ['a' | 'b', number | boolean][] -var entries3 = Object.entries({}); // [never, any][] +var entries = Object.entries(o); +var entries1 = Object.entries(1); +var entries2 = Object.entries({ a: true, b: 2 }); +var entries3 = Object.entries({}); diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.symbols b/tests/baselines/reference/useObjectValuesAndEntries1.symbols index 2c412b7a8ff3c..23a331b11f883 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries1.symbols +++ b/tests/baselines/reference/useObjectValuesAndEntries1.symbols @@ -6,9 +6,9 @@ var o = { a: 1, b: 2 }; for (var x of Object.values(o)) { >x : Symbol(x, Decl(useObjectValuesAndEntries1.ts, 2, 8)) ->Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --)) >o : Symbol(o, Decl(useObjectValuesAndEntries1.ts, 0, 3)) let y = x; @@ -16,30 +16,30 @@ for (var x of Object.values(o)) { >x : Symbol(x, Decl(useObjectValuesAndEntries1.ts, 2, 8)) } -var entries = Object.entries(o); // <-- entries: ['a' | 'b', number][] +var entries = Object.entries(o); >entries : Symbol(entries, Decl(useObjectValuesAndEntries1.ts, 6, 3)) ->Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) >o : Symbol(o, Decl(useObjectValuesAndEntries1.ts, 0, 3)) -var entries1 = Object.entries(1); // <-- entries: [string, any][] +var entries1 = Object.entries(1); >entries1 : Symbol(entries1, Decl(useObjectValuesAndEntries1.ts, 7, 3)) ->Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) -var entries2 = Object.entries({a: true, b: 2}) // ['a' | 'b', number | boolean][] +var entries2 = Object.entries({a: true, b: 2}) >entries2 : Symbol(entries2, Decl(useObjectValuesAndEntries1.ts, 8, 3)) ->Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) >a : Symbol(a, Decl(useObjectValuesAndEntries1.ts, 8, 31)) >b : Symbol(b, Decl(useObjectValuesAndEntries1.ts, 8, 39)) -var entries3 = Object.entries({}) // [never, any][] +var entries3 = Object.entries({}) >entries3 : Symbol(entries3, Decl(useObjectValuesAndEntries1.ts, 9, 3)) ->Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.types b/tests/baselines/reference/useObjectValuesAndEntries1.types index 0cb080c647796..b04a001e183cc 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries1.types +++ b/tests/baselines/reference/useObjectValuesAndEntries1.types @@ -10,9 +10,9 @@ var o = { a: 1, b: 2 }; for (var x of Object.values(o)) { >x : number >Object.values(o) : number[] ->Object.values : { (o: { [s: string]: T; } | { [n: number]: T; }): T[]; (o: any): any[]; } +>Object.values : (o: T) => T[keyof T][] >Object : ObjectConstructor ->values : { (o: { [s: string]: T; } | { [n: number]: T; }): T[]; (o: any): any[]; } +>values : (o: T) => T[keyof T][] >o : { a: number; b: number; } let y = x; @@ -20,39 +20,39 @@ for (var x of Object.values(o)) { >x : number } -var entries = Object.entries(o); // <-- entries: ['a' | 'b', number][] +var entries = Object.entries(o); >entries : [string, number][] >Object.entries(o) : [string, number][] ->Object.entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: any): [string, any][]; } +>Object.entries : (o: T) => [string, T[keyof T]][] >Object : ObjectConstructor ->entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: any): [string, any][]; } +>entries : (o: T) => [string, T[keyof T]][] >o : { a: number; b: number; } -var entries1 = Object.entries(1); // <-- entries: [string, any][] ->entries1 : [string, any][] ->Object.entries(1) : [string, any][] ->Object.entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: any): [string, any][]; } +var entries1 = Object.entries(1); +>entries1 : any +>Object.entries(1) : any +>Object.entries : (o: T) => [string, T[keyof T]][] >Object : ObjectConstructor ->entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: any): [string, any][]; } +>entries : (o: T) => [string, T[keyof T]][] >1 : 1 -var entries2 = Object.entries({a: true, b: 2}) // ['a' | 'b', number | boolean][] +var entries2 = Object.entries({a: true, b: 2}) >entries2 : [string, number | boolean][] >Object.entries({a: true, b: 2}) : [string, number | boolean][] ->Object.entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: any): [string, any][]; } +>Object.entries : (o: T) => [string, T[keyof T]][] >Object : ObjectConstructor ->entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: any): [string, any][]; } +>entries : (o: T) => [string, T[keyof T]][] >{a: true, b: 2} : { a: boolean; b: number; } >a : boolean >true : true >b : number >2 : 2 -var entries3 = Object.entries({}) // [never, any][] ->entries3 : [string, {}][] ->Object.entries({}) : [string, {}][] ->Object.entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: any): [string, any][]; } +var entries3 = Object.entries({}) +>entries3 : [string, any][] +>Object.entries({}) : [string, any][] +>Object.entries : (o: T) => [string, T[keyof T]][] >Object : ObjectConstructor ->entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: any): [string, any][]; } +>entries : (o: T) => [string, T[keyof T]][] >{} : {} diff --git a/tests/baselines/reference/useObjectValuesAndEntries4.symbols b/tests/baselines/reference/useObjectValuesAndEntries4.symbols index adef865c04cca..4cf60a245b3c1 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries4.symbols +++ b/tests/baselines/reference/useObjectValuesAndEntries4.symbols @@ -6,9 +6,9 @@ var o = { a: 1, b: 2 }; for (var x of Object.values(o)) { >x : Symbol(x, Decl(useObjectValuesAndEntries4.ts, 2, 8)) ->Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) ->values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --)) >o : Symbol(o, Decl(useObjectValuesAndEntries4.ts, 0, 3)) let y = x; @@ -18,8 +18,8 @@ for (var x of Object.values(o)) { var entries = Object.entries(o); >entries : Symbol(entries, Decl(useObjectValuesAndEntries4.ts, 6, 3)) ->Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) ->entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) >o : Symbol(o, Decl(useObjectValuesAndEntries4.ts, 0, 3)) diff --git a/tests/baselines/reference/useObjectValuesAndEntries4.types b/tests/baselines/reference/useObjectValuesAndEntries4.types index 245803a24d435..080a15ad7afe9 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries4.types +++ b/tests/baselines/reference/useObjectValuesAndEntries4.types @@ -10,9 +10,9 @@ var o = { a: 1, b: 2 }; for (var x of Object.values(o)) { >x : number >Object.values(o) : number[] ->Object.values : { (o: { [s: string]: T; } | { [n: number]: T; }): T[]; (o: any): any[]; } +>Object.values : (o: T) => T[keyof T][] >Object : ObjectConstructor ->values : { (o: { [s: string]: T; } | { [n: number]: T; }): T[]; (o: any): any[]; } +>values : (o: T) => T[keyof T][] >o : { a: number; b: number; } let y = x; @@ -23,8 +23,8 @@ for (var x of Object.values(o)) { var entries = Object.entries(o); >entries : [string, number][] >Object.entries(o) : [string, number][] ->Object.entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: any): [string, any][]; } +>Object.entries : (o: T) => [string, T[keyof T]][] >Object : ObjectConstructor ->entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: any): [string, any][]; } +>entries : (o: T) => [string, T[keyof T]][] >o : { a: number; b: number; } diff --git a/tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts b/tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts index 60099bb1c0f6d..719f10bbbcc8d 100644 --- a/tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts +++ b/tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts @@ -7,7 +7,7 @@ for (var x of Object.values(o)) { let y = x; } -var entries = Object.entries(o); // <-- entries: ['a' | 'b', number][] -var entries1 = Object.entries(1); // <-- entries: [string, any][] -var entries2 = Object.entries({a: true, b: 2}) // ['a' | 'b', number | boolean][] -var entries3 = Object.entries({}) // [never, any][] +var entries = Object.entries(o); +var entries1 = Object.entries(1); +var entries2 = Object.entries({a: true, b: 2}) +var entries3 = Object.entries({}) From 4bb3c902250c659580537c6f8f86f979d77e321d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 8 Jan 2018 12:40:21 -0800 Subject: [PATCH 3/3] Revert everything but change to parameter types --- src/lib/es2017.object.d.ts | 15 ++++++++-- .../useObjectValuesAndEntries1.errors.txt | 17 ----------- .../useObjectValuesAndEntries1.symbols | 20 ++++++------- .../useObjectValuesAndEntries1.types | 28 +++++++++---------- .../useObjectValuesAndEntries4.symbols | 8 +++--- .../useObjectValuesAndEntries4.types | 8 +++--- 6 files changed, 45 insertions(+), 51 deletions(-) delete mode 100644 tests/baselines/reference/useObjectValuesAndEntries1.errors.txt diff --git a/src/lib/es2017.object.d.ts b/src/lib/es2017.object.d.ts index ad9bd6533f6d8..775aaece7f621 100644 --- a/src/lib/es2017.object.d.ts +++ b/src/lib/es2017.object.d.ts @@ -3,14 +3,25 @@ interface ObjectConstructor { * Returns an array of values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - values(o: T): T[keyof T][]; + values(o: { [s: string]: T } | { [n: number]: T }): T[]; + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + values(o: {}): any[]; + + /** + * Returns an array of key/values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + entries(o: { [s: string]: T } | { [n: number]: T }): [string, T][]; /** * Returns an array of key/values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - entries(o: T): [string, T[keyof T]][]; + entries(o: {}): [string, any][]; /** * Returns an object containing all own property descriptors of an object diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.errors.txt b/tests/baselines/reference/useObjectValuesAndEntries1.errors.txt deleted file mode 100644 index 1894f6d0400e0..0000000000000 --- a/tests/baselines/reference/useObjectValuesAndEntries1.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts(8,31): error TS2345: Argument of type '1' is not assignable to parameter of type 'object'. - - -==== tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts (1 errors) ==== - var o = { a: 1, b: 2 }; - - for (var x of Object.values(o)) { - let y = x; - } - - var entries = Object.entries(o); - var entries1 = Object.entries(1); - ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'object'. - var entries2 = Object.entries({a: true, b: 2}) - var entries3 = Object.entries({}) - \ No newline at end of file diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.symbols b/tests/baselines/reference/useObjectValuesAndEntries1.symbols index 23a331b11f883..538e3f69d78f3 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries1.symbols +++ b/tests/baselines/reference/useObjectValuesAndEntries1.symbols @@ -6,9 +6,9 @@ var o = { a: 1, b: 2 }; for (var x of Object.values(o)) { >x : Symbol(x, Decl(useObjectValuesAndEntries1.ts, 2, 8)) ->Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --)) +>Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --)) +>values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >o : Symbol(o, Decl(useObjectValuesAndEntries1.ts, 0, 3)) let y = x; @@ -18,28 +18,28 @@ for (var x of Object.values(o)) { var entries = Object.entries(o); >entries : Symbol(entries, Decl(useObjectValuesAndEntries1.ts, 6, 3)) ->Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >o : Symbol(o, Decl(useObjectValuesAndEntries1.ts, 0, 3)) var entries1 = Object.entries(1); >entries1 : Symbol(entries1, Decl(useObjectValuesAndEntries1.ts, 7, 3)) ->Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) var entries2 = Object.entries({a: true, b: 2}) >entries2 : Symbol(entries2, Decl(useObjectValuesAndEntries1.ts, 8, 3)) ->Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >a : Symbol(a, Decl(useObjectValuesAndEntries1.ts, 8, 31)) >b : Symbol(b, Decl(useObjectValuesAndEntries1.ts, 8, 39)) var entries3 = Object.entries({}) >entries3 : Symbol(entries3, Decl(useObjectValuesAndEntries1.ts, 9, 3)) ->Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.types b/tests/baselines/reference/useObjectValuesAndEntries1.types index b04a001e183cc..c52d0ce872e09 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries1.types +++ b/tests/baselines/reference/useObjectValuesAndEntries1.types @@ -10,9 +10,9 @@ var o = { a: 1, b: 2 }; for (var x of Object.values(o)) { >x : number >Object.values(o) : number[] ->Object.values : (o: T) => T[keyof T][] +>Object.values : { (o: { [s: string]: T; } | { [n: number]: T; }): T[]; (o: {}): any[]; } >Object : ObjectConstructor ->values : (o: T) => T[keyof T][] +>values : { (o: { [s: string]: T; } | { [n: number]: T; }): T[]; (o: {}): any[]; } >o : { a: number; b: number; } let y = x; @@ -23,25 +23,25 @@ for (var x of Object.values(o)) { var entries = Object.entries(o); >entries : [string, number][] >Object.entries(o) : [string, number][] ->Object.entries : (o: T) => [string, T[keyof T]][] +>Object.entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: {}): [string, any][]; } >Object : ObjectConstructor ->entries : (o: T) => [string, T[keyof T]][] +>entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: {}): [string, any][]; } >o : { a: number; b: number; } var entries1 = Object.entries(1); ->entries1 : any ->Object.entries(1) : any ->Object.entries : (o: T) => [string, T[keyof T]][] +>entries1 : [string, any][] +>Object.entries(1) : [string, any][] +>Object.entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: {}): [string, any][]; } >Object : ObjectConstructor ->entries : (o: T) => [string, T[keyof T]][] +>entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: {}): [string, any][]; } >1 : 1 var entries2 = Object.entries({a: true, b: 2}) >entries2 : [string, number | boolean][] >Object.entries({a: true, b: 2}) : [string, number | boolean][] ->Object.entries : (o: T) => [string, T[keyof T]][] +>Object.entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: {}): [string, any][]; } >Object : ObjectConstructor ->entries : (o: T) => [string, T[keyof T]][] +>entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: {}): [string, any][]; } >{a: true, b: 2} : { a: boolean; b: number; } >a : boolean >true : true @@ -49,10 +49,10 @@ var entries2 = Object.entries({a: true, b: 2}) >2 : 2 var entries3 = Object.entries({}) ->entries3 : [string, any][] ->Object.entries({}) : [string, any][] ->Object.entries : (o: T) => [string, T[keyof T]][] +>entries3 : [string, {}][] +>Object.entries({}) : [string, {}][] +>Object.entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: {}): [string, any][]; } >Object : ObjectConstructor ->entries : (o: T) => [string, T[keyof T]][] +>entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: {}): [string, any][]; } >{} : {} diff --git a/tests/baselines/reference/useObjectValuesAndEntries4.symbols b/tests/baselines/reference/useObjectValuesAndEntries4.symbols index 4cf60a245b3c1..adef865c04cca 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries4.symbols +++ b/tests/baselines/reference/useObjectValuesAndEntries4.symbols @@ -6,9 +6,9 @@ var o = { a: 1, b: 2 }; for (var x of Object.values(o)) { >x : Symbol(x, Decl(useObjectValuesAndEntries4.ts, 2, 8)) ->Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --)) +>Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) ->values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --)) +>values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >o : Symbol(o, Decl(useObjectValuesAndEntries4.ts, 0, 3)) let y = x; @@ -18,8 +18,8 @@ for (var x of Object.values(o)) { var entries = Object.entries(o); >entries : Symbol(entries, Decl(useObjectValuesAndEntries4.ts, 6, 3)) ->Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) ->entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >o : Symbol(o, Decl(useObjectValuesAndEntries4.ts, 0, 3)) diff --git a/tests/baselines/reference/useObjectValuesAndEntries4.types b/tests/baselines/reference/useObjectValuesAndEntries4.types index 080a15ad7afe9..33a427760a814 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries4.types +++ b/tests/baselines/reference/useObjectValuesAndEntries4.types @@ -10,9 +10,9 @@ var o = { a: 1, b: 2 }; for (var x of Object.values(o)) { >x : number >Object.values(o) : number[] ->Object.values : (o: T) => T[keyof T][] +>Object.values : { (o: { [s: string]: T; } | { [n: number]: T; }): T[]; (o: {}): any[]; } >Object : ObjectConstructor ->values : (o: T) => T[keyof T][] +>values : { (o: { [s: string]: T; } | { [n: number]: T; }): T[]; (o: {}): any[]; } >o : { a: number; b: number; } let y = x; @@ -23,8 +23,8 @@ for (var x of Object.values(o)) { var entries = Object.entries(o); >entries : [string, number][] >Object.entries(o) : [string, number][] ->Object.entries : (o: T) => [string, T[keyof T]][] +>Object.entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: {}): [string, any][]; } >Object : ObjectConstructor ->entries : (o: T) => [string, T[keyof T]][] +>entries : { (o: { [s: string]: T; } | { [n: number]: T; }): [string, T][]; (o: {}): [string, any][]; } >o : { a: number; b: number; }