diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index f3eb069e6f647..b525a55f755ac 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1192,6 +1192,7 @@ export namespace Completion { typeEntry("Partial"), typeEntry("Required"), typeEntry("Readonly"), + typeEntry("Writable"), typeEntry("Pick"), typeEntry("Record"), typeEntry("Exclude"), diff --git a/src/lib/es2015.core.d.ts b/src/lib/es2015.core.d.ts index 3b1c76c5afc3c..e8eb13c33f935 100644 --- a/src/lib/es2015.core.d.ts +++ b/src/lib/es2015.core.d.ts @@ -257,13 +257,20 @@ interface NumberConstructor { } interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + */ + assign(target: T): T; + /** * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. * @param source The source object from which to copy properties. */ - assign(target: T, source: U): T & U; + assign(target: T, source: U): T & Writable; /** * Copy the values of all of the enumerable own properties from one or more source objects to a @@ -272,7 +279,7 @@ interface ObjectConstructor { * @param source1 The first source object from which to copy properties. * @param source2 The second source object from which to copy properties. */ - assign(target: T, source1: U, source2: V): T & U & V; + assign(target: T, source1: U, source2: V): T & Writable & Writable; /** * Copy the values of all of the enumerable own properties from one or more source objects to a @@ -282,21 +289,21 @@ interface ObjectConstructor { * @param source2 The second source object from which to copy properties. * @param source3 The third source object from which to copy properties. */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + assign(target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; /** * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties + * @param sources One or more source objects from which to copy properties. */ - assign(target: object, ...sources: any[]): any; + assign(target: {}, ...sources: any[]): any; /** * Returns an array of all symbol properties found directly on object o. * @param o Object to retrieve the symbols from. */ - getOwnPropertySymbols(o: any): symbol[]; + getOwnPropertySymbols(o: {}): symbol[]; /** * Returns the names of the enumerable string properties and methods of an object. @@ -316,7 +323,7 @@ interface ObjectConstructor { * @param o The object to change its prototype. * @param proto The value of the new prototype or null. */ - setPrototypeOf(o: any, proto: object | null): any; + setPrototypeOf(o: {}, proto: object | null): any; } interface ReadonlyArray { diff --git a/src/lib/es2017.object.d.ts b/src/lib/es2017.object.d.ts index b3ace85bef182..3e5dcc95629fe 100644 --- a/src/lib/es2017.object.d.ts +++ b/src/lib/es2017.object.d.ts @@ -27,5 +27,5 @@ interface ObjectConstructor { * Returns an object containing all own property descriptors 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. */ - getOwnPropertyDescriptors(o: T): {[P in keyof T]: TypedPropertyDescriptor} & { [x: string]: PropertyDescriptor }; + getOwnPropertyDescriptors(o: T): { [P in keyof T]: TypedPropertyDescriptor } & PropertyDescriptorMap; } diff --git a/src/lib/es2019.object.d.ts b/src/lib/es2019.object.d.ts index e3518b7b9d689..7efcb4b861f13 100644 --- a/src/lib/es2019.object.d.ts +++ b/src/lib/es2019.object.d.ts @@ -5,7 +5,7 @@ interface ObjectConstructor { * Returns an object created by key-value entries for properties and methods * @param entries An iterable object that contains key-value entries for properties and methods. */ - fromEntries(entries: Iterable): { [k: string]: T }; + fromEntries(entries: Iterable): { [k: PropertyKey]: T }; /** * Returns an object created by key-value entries for properties and methods diff --git a/src/lib/es2022.object.d.ts b/src/lib/es2022.object.d.ts index 7325ef3c343e2..0a07706ba941c 100644 --- a/src/lib/es2022.object.d.ts +++ b/src/lib/es2022.object.d.ts @@ -4,5 +4,5 @@ interface ObjectConstructor { * @param o An object. * @param v A property name. */ - hasOwn(o: object, v: PropertyKey): boolean; + hasOwn(o: {}, v: PropertyKey): boolean; } diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index a74b3cb4c2111..3d7959392fad1 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -146,7 +146,7 @@ interface ObjectConstructor { * Returns the prototype of an object. * @param o The object that references the prototype. */ - getPrototypeOf(o: any): any; + getPrototypeOf(o: {}): any; /** * Gets the own property descriptor of the specified object. @@ -154,14 +154,14 @@ interface ObjectConstructor { * @param o Object that contains the property. * @param p Name of the property. */ - getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; + getOwnPropertyDescriptor(o: {}, p: PropertyKey): PropertyDescriptor | undefined; /** * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ - getOwnPropertyNames(o: any): string[]; + getOwnPropertyNames(o: {}): string[]; /** * Creates an object that has the specified prototype or that has null prototype. @@ -182,14 +182,14 @@ interface ObjectConstructor { * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor property. */ - defineProperty(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType): T; + defineProperty(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType): T; /** * Adds one or more properties to an object, and/or modifies attributes of existing properties. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. */ - defineProperties(o: T, properties: PropertyDescriptorMap & ThisType): T; + defineProperties(o: T, properties: PropertyDescriptorMap & ThisType): T; /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. @@ -207,7 +207,7 @@ interface ObjectConstructor { * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - freeze(o: T): Readonly; + freeze(o: T): Readonly; /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. @@ -225,19 +225,37 @@ interface ObjectConstructor { * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. * @param o Object to test. */ - isSealed(o: any): boolean; + isSealed(o: object): boolean; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): true; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: object): boolean; /** * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. * @param o Object to test. */ - isFrozen(o: any): boolean; + isFrozen(o: any): true; /** * Returns a value that indicates whether new properties can be added to an object. * @param o Object to test. */ - isExtensible(o: any): boolean; + isExtensible(o: object): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): false; /** * Returns the names of the enumerable string properties and methods of an object. @@ -1555,6 +1573,13 @@ type Readonly = { readonly [P in keyof T]: T[P]; }; +/** + * Make all properties in T writable + */ +type Writable = { + -readonly [P in keyof T]: T[P]; +}; + /** * From T, pick a set of properties whose keys are in the union K */ diff --git a/src/testRunner/parallel/worker.ts b/src/testRunner/parallel/worker.ts index 05c1038488291..b333556164974 100644 --- a/src/testRunner/parallel/worker.ts +++ b/src/testRunner/parallel/worker.ts @@ -196,7 +196,7 @@ export function start() { newSuite.addTest(test); root.addSuite(newSuite); Object.setPrototypeOf(newSuite.ctx, root.ctx); - Object.setPrototypeOf(test.ctx, root.ctx); + Object.setPrototypeOf(test.ctx!, root.ctx); test.parent = newSuite; suite = newSuite; } diff --git a/tests/baselines/reference/checkExportsObjectAssignProperty.types b/tests/baselines/reference/checkExportsObjectAssignProperty.types index 60fcd84477a12..77277f90ce369 100644 --- a/tests/baselines/reference/checkExportsObjectAssignProperty.types +++ b/tests/baselines/reference/checkExportsObjectAssignProperty.types @@ -176,9 +176,9 @@ m2.setonlyAccessor = 0; === tests/cases/conformance/jsdoc/mod1.js === Object.defineProperty(exports, "thing", { value: 42, writable: true }); >Object.defineProperty(exports, "thing", { value: 42, writable: true }) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"thing" : "thing" >{ value: 42, writable: true } : { value: number; writable: true; } @@ -189,9 +189,9 @@ Object.defineProperty(exports, "thing", { value: 42, writable: true }); Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); >Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"readonlyProp" : "readonlyProp" >{ value: "Smith", writable: false } : { value: string; writable: false; } @@ -202,9 +202,9 @@ Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); >Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"rwAccessors" : "rwAccessors" >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } @@ -215,9 +215,9 @@ Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); >Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"readonlyAccessor" : "readonlyAccessor" >{ get() { return 21.75 } } : { get(): number; } @@ -226,9 +226,9 @@ Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); Object.defineProperty(exports, "setonlyAccessor", { >Object.defineProperty(exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"setonlyAccessor" : "setonlyAccessor" >{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } @@ -252,9 +252,9 @@ Object.defineProperty(exports, "setonlyAccessor", { === tests/cases/conformance/jsdoc/mod2.js === Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); >Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -267,9 +267,9 @@ Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }) Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); >Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -282,9 +282,9 @@ Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); >Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -297,9 +297,9 @@ Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, s Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); >Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -310,9 +310,9 @@ Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 Object.defineProperty(module.exports, "setonlyAccessor", { >Object.defineProperty(module.exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports diff --git a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.types b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.types index 6ea6a5ff129b8..1a24db4e9ec46 100644 --- a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.types +++ b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.types @@ -129,9 +129,9 @@ Person.prototype.describe = function () { }; Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); >Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }) : any ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Person.prototype : any >Person : typeof Person >prototype : any @@ -144,9 +144,9 @@ Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); >Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }) : any ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Person.prototype : any >Person : typeof Person >prototype : any @@ -159,9 +159,9 @@ Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writab Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); >Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Person.prototype : any >Person : typeof Person >prototype : any @@ -174,9 +174,9 @@ Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); >Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }) : any ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Person.prototype : any >Person : typeof Person >prototype : any @@ -187,9 +187,9 @@ Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21. Object.defineProperty(Person.prototype, "setonlyAccessor", { >Object.defineProperty(Person.prototype, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Person.prototype : any >Person : typeof Person >prototype : any diff --git a/tests/baselines/reference/checkObjectDefineProperty.types b/tests/baselines/reference/checkObjectDefineProperty.types index 05f8b200c51f8..a96c2e2209571 100644 --- a/tests/baselines/reference/checkObjectDefineProperty.types +++ b/tests/baselines/reference/checkObjectDefineProperty.types @@ -89,9 +89,9 @@ const x = {}; Object.defineProperty(x, "name", { value: "Charles", writable: true }); >Object.defineProperty(x, "name", { value: "Charles", writable: true }) : typeof x ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >x : typeof x >"name" : "name" >{ value: "Charles", writable: true } : { value: string; writable: true; } @@ -102,9 +102,9 @@ Object.defineProperty(x, "name", { value: "Charles", writable: true }); Object.defineProperty(x, "middleInit", { value: "H" }); >Object.defineProperty(x, "middleInit", { value: "H" }) : typeof x ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >x : typeof x >"middleInit" : "middleInit" >{ value: "H" } : { value: string; } @@ -113,9 +113,9 @@ Object.defineProperty(x, "middleInit", { value: "H" }); Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); >Object.defineProperty(x, "lastName", { value: "Smith", writable: false }) : typeof x ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >x : typeof x >"lastName" : "lastName" >{ value: "Smith", writable: false } : { value: string; writable: false; } @@ -126,9 +126,9 @@ Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); >Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof x ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >x : typeof x >"zip" : "zip" >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } @@ -139,9 +139,9 @@ Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); >Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }) : typeof x ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >x : typeof x >"houseNumber" : "houseNumber" >{ get() { return 21.75 } } : { get(): number; } @@ -150,9 +150,9 @@ Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); Object.defineProperty(x, "zipStr", { >Object.defineProperty(x, "zipStr", { /** @param {string} str */ set(str) { this.zip = Number(str) }}) : typeof x ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >x : typeof x >"zipStr" : "zipStr" >{ /** @param {string} str */ set(str) { this.zip = Number(str) }} : { set(str: string): void; } diff --git a/tests/baselines/reference/checkOtherObjectAssignProperty.types b/tests/baselines/reference/checkOtherObjectAssignProperty.types index 180ea63989945..0ffa9620bc5fc 100644 --- a/tests/baselines/reference/checkOtherObjectAssignProperty.types +++ b/tests/baselines/reference/checkOtherObjectAssignProperty.types @@ -89,9 +89,9 @@ const obj = { value: 42, writable: true }; Object.defineProperty(exports, "thing", obj); >Object.defineProperty(exports, "thing", obj) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"thing" : "thing" >obj : { value: number; writable: boolean; } @@ -106,9 +106,9 @@ let str = /** @type {string} */("other"); Object.defineProperty(exports, str, { value: 42, writable: true }); >Object.defineProperty(exports, str, { value: 42, writable: true }) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >str : string >{ value: 42, writable: true } : { value: number; writable: true; } @@ -123,9 +123,9 @@ const propName = "prop" Object.defineProperty(exports, propName, { value: 42, writable: true }); >Object.defineProperty(exports, propName, { value: 42, writable: true }) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >propName : "prop" >{ value: 42, writable: true } : { value: number; writable: true; } @@ -137,18 +137,18 @@ Object.defineProperty(exports, propName, { value: 42, writable: true }); Object.defineProperty(exports, "bad1", { }); >Object.defineProperty(exports, "bad1", { }) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"bad1" : "bad1" >{ } : {} Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); >Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"bad2" : "bad2" >{ get() { return 12 }, value: "no" } : { get(): number; value: string; } @@ -159,9 +159,9 @@ Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); Object.defineProperty(exports, "bad3", { writable: true }); >Object.defineProperty(exports, "bad3", { writable: true }) : typeof import("tests/cases/conformance/jsdoc/mod1") ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"bad3" : "bad3" >{ writable: true } : { writable: true; } diff --git a/tests/baselines/reference/completionsStringMethods.baseline b/tests/baselines/reference/completionsStringMethods.baseline index 0ef6b4203714d..13c750ed9ead3 100644 --- a/tests/baselines/reference/completionsStringMethods.baseline +++ b/tests/baselines/reference/completionsStringMethods.baseline @@ -1105,7 +1105,7 @@ "target": { "fileName": "lib.d.ts", "textSpan": { - "start": 18529, + "start": 19171, "length": 28 } } @@ -1128,7 +1128,7 @@ "target": { "fileName": "lib.d.ts", "textSpan": { - "start": 18529, + "start": 19171, "length": 28 } } diff --git a/tests/baselines/reference/conditionalTypeDoesntSpinForever.symbols b/tests/baselines/reference/conditionalTypeDoesntSpinForever.symbols index b5dcb78015b3f..3e2f1b61b791a 100644 --- a/tests/baselines/reference/conditionalTypeDoesntSpinForever.symbols +++ b/tests/baselines/reference/conditionalTypeDoesntSpinForever.symbols @@ -77,9 +77,9 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {name: instance as TYPE}) as SO_FAR & {name: TYPE}) as BuildPubSubRecordType >buildPubSubRecordType : Symbol(buildPubSubRecordType, Decl(conditionalTypeDoesntSpinForever.ts, 108, 7)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >soFar : Symbol(soFar, Decl(conditionalTypeDoesntSpinForever.ts, 21, 45)) >name : Symbol(name, Decl(conditionalTypeDoesntSpinForever.ts, 24, 56)) >instance : Symbol(instance, Decl(conditionalTypeDoesntSpinForever.ts, 23, 19)) @@ -133,9 +133,9 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as >buildPubSubRecordType : Symbol(buildPubSubRecordType, Decl(conditionalTypeDoesntSpinForever.ts, 108, 7)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >soFar : Symbol(soFar, Decl(conditionalTypeDoesntSpinForever.ts, 34, 44)) >storedAs : Symbol(storedAs, Decl(conditionalTypeDoesntSpinForever.ts, 37, 56)) >PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString : Symbol(PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString, Decl(conditionalTypeDoesntSpinForever.ts, 4, 28)) @@ -154,9 +154,9 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as >buildPubSubRecordType : Symbol(buildPubSubRecordType, Decl(conditionalTypeDoesntSpinForever.ts, 108, 7)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >soFar : Symbol(soFar, Decl(conditionalTypeDoesntSpinForever.ts, 34, 44)) >storedAs : Symbol(storedAs, Decl(conditionalTypeDoesntSpinForever.ts, 40, 56)) >PubSubRecordIsStoredInRedisAsA.redisHash : Symbol(PubSubRecordIsStoredInRedisAsA.redisHash, Decl(conditionalTypeDoesntSpinForever.ts, 3, 44)) @@ -217,9 +217,9 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {identifier: instance as TYPE}) as SO_FAR & {identifier: TYPE}) as BuildPubSubRecordType >buildPubSubRecordType : Symbol(buildPubSubRecordType, Decl(conditionalTypeDoesntSpinForever.ts, 108, 7)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >soFar : Symbol(soFar, Decl(conditionalTypeDoesntSpinForever.ts, 51, 51)) >identifier : Symbol(identifier, Decl(conditionalTypeDoesntSpinForever.ts, 54, 56)) >instance : Symbol(instance, Decl(conditionalTypeDoesntSpinForever.ts, 53, 25)) @@ -271,9 +271,9 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {record: instance as TYPE}) as SO_FAR & {record: TYPE}) as BuildPubSubRecordType >buildPubSubRecordType : Symbol(buildPubSubRecordType, Decl(conditionalTypeDoesntSpinForever.ts, 108, 7)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >soFar : Symbol(soFar, Decl(conditionalTypeDoesntSpinForever.ts, 63, 47)) >record : Symbol(record, Decl(conditionalTypeDoesntSpinForever.ts, 66, 56)) >instance : Symbol(instance, Decl(conditionalTypeDoesntSpinForever.ts, 65, 21)) @@ -327,9 +327,9 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: instance})) as BuildPubSubRecordType, >buildPubSubRecordType : Symbol(buildPubSubRecordType, Decl(conditionalTypeDoesntSpinForever.ts, 108, 7)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >soFar : Symbol(soFar, Decl(conditionalTypeDoesntSpinForever.ts, 76, 68)) >maxMsToWaitBeforePublishing : Symbol(maxMsToWaitBeforePublishing, Decl(conditionalTypeDoesntSpinForever.ts, 79, 56)) >instance : Symbol(instance, Decl(conditionalTypeDoesntSpinForever.ts, 78, 36)) @@ -342,9 +342,9 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0})) as BuildPubSubRecordType, >buildPubSubRecordType : Symbol(buildPubSubRecordType, Decl(conditionalTypeDoesntSpinForever.ts, 108, 7)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >soFar : Symbol(soFar, Decl(conditionalTypeDoesntSpinForever.ts, 76, 68)) >maxMsToWaitBeforePublishing : Symbol(maxMsToWaitBeforePublishing, Decl(conditionalTypeDoesntSpinForever.ts, 81, 56)) >BuildPubSubRecordType : Symbol(BuildPubSubRecordType, Decl(conditionalTypeDoesntSpinForever.ts, 98, 4)) @@ -450,9 +450,9 @@ export enum PubSubRecordIsStoredInRedisAsA { >SO_FAR : Symbol(SO_FAR, Decl(conditionalTypeDoesntSpinForever.ts, 108, 33)) >soFar : Symbol(soFar, Decl(conditionalTypeDoesntSpinForever.ts, 108, 41)) >SO_FAR : Symbol(SO_FAR, Decl(conditionalTypeDoesntSpinForever.ts, 108, 33)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) {}, buildNameFieldConstructor(soFar), diff --git a/tests/baselines/reference/conditionalTypeDoesntSpinForever.types b/tests/baselines/reference/conditionalTypeDoesntSpinForever.types index a7b17a7cc6d0a..83bb366ca0913 100644 --- a/tests/baselines/reference/conditionalTypeDoesntSpinForever.types +++ b/tests/baselines/reference/conditionalTypeDoesntSpinForever.types @@ -68,10 +68,10 @@ export enum PubSubRecordIsStoredInRedisAsA { >buildPubSubRecordType(Object.assign({}, soFar, {name: instance as TYPE}) as SO_FAR & {name: TYPE}) : BuildPubSubRecordType >buildPubSubRecordType : (soFar: SO_FAR) => BuildPubSubRecordType >Object.assign({}, soFar, {name: instance as TYPE}) as SO_FAR & {name: TYPE} : SO_FAR & { name: TYPE; } ->Object.assign({}, soFar, {name: instance as TYPE}) : SO_FAR & { name: TYPE; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign({}, soFar, {name: instance as TYPE}) : Writable & Writable<{ name: TYPE; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >{} : {} >soFar : SO_FAR >{name: instance as TYPE} : { name: TYPE; } @@ -120,12 +120,12 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as >buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as BuildPubSubRecordType : BuildPubSubRecordType ->buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) : BuildPubSubRecordType +>buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) : BuildPubSubRecordType & Writable<{ storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString; }>> >buildPubSubRecordType : (soFar: SO_FAR) => BuildPubSubRecordType ->Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString}) : SO_FAR & { storedAs: PubSubRecordIsStoredInRedisAsA; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString}) : Writable & Writable<{ storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >{} : {} >soFar : SO_FAR >{storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString} : { storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString; } @@ -144,12 +144,12 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as >buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as BuildPubSubRecordType : BuildPubSubRecordType ->buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) : BuildPubSubRecordType +>buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) : BuildPubSubRecordType & Writable<{ storedAs: PubSubRecordIsStoredInRedisAsA.redisHash; }>> >buildPubSubRecordType : (soFar: SO_FAR) => BuildPubSubRecordType ->Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash}) : SO_FAR & { storedAs: PubSubRecordIsStoredInRedisAsA; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash}) : Writable & Writable<{ storedAs: PubSubRecordIsStoredInRedisAsA.redisHash; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >{} : {} >soFar : SO_FAR >{storedAs: PubSubRecordIsStoredInRedisAsA.redisHash} : { storedAs: PubSubRecordIsStoredInRedisAsA.redisHash; } @@ -212,10 +212,10 @@ export enum PubSubRecordIsStoredInRedisAsA { >buildPubSubRecordType(Object.assign({}, soFar, {identifier: instance as TYPE}) as SO_FAR & {identifier: TYPE}) : BuildPubSubRecordType >buildPubSubRecordType : (soFar: SO_FAR) => BuildPubSubRecordType >Object.assign({}, soFar, {identifier: instance as TYPE}) as SO_FAR & {identifier: TYPE} : SO_FAR & { identifier: TYPE; } ->Object.assign({}, soFar, {identifier: instance as TYPE}) : SO_FAR & Record<"record", unknown> & { identifier: TYPE; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign({}, soFar, {identifier: instance as TYPE}) : Writable> & Writable<{ identifier: TYPE; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >{} : {} >soFar : SO_FAR & Record<"record", unknown> >{identifier: instance as TYPE} : { identifier: TYPE; } @@ -264,10 +264,10 @@ export enum PubSubRecordIsStoredInRedisAsA { >buildPubSubRecordType(Object.assign({}, soFar, {record: instance as TYPE}) as SO_FAR & {record: TYPE}) : BuildPubSubRecordType >buildPubSubRecordType : (soFar: SO_FAR) => BuildPubSubRecordType >Object.assign({}, soFar, {record: instance as TYPE}) as SO_FAR & {record: TYPE} : SO_FAR & { record: TYPE; } ->Object.assign({}, soFar, {record: instance as TYPE}) : SO_FAR & { record: TYPE; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign({}, soFar, {record: instance as TYPE}) : Writable & Writable<{ record: TYPE; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >{} : {} >soFar : SO_FAR >{record: instance as TYPE} : { record: TYPE; } @@ -318,12 +318,12 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: instance})) as BuildPubSubRecordType, >buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: instance})) as BuildPubSubRecordType : BuildPubSubRecordType ->buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: instance})) : BuildPubSubRecordType +>buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: instance})) : BuildPubSubRecordType & Writable<{ maxMsToWaitBeforePublishing: number; }>> >buildPubSubRecordType : (soFar: SO_FAR) => BuildPubSubRecordType ->Object.assign({}, soFar, {maxMsToWaitBeforePublishing: instance}) : SO_FAR & { maxMsToWaitBeforePublishing: number; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign({}, soFar, {maxMsToWaitBeforePublishing: instance}) : Writable & Writable<{ maxMsToWaitBeforePublishing: number; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >{} : {} >soFar : SO_FAR >{maxMsToWaitBeforePublishing: instance} : { maxMsToWaitBeforePublishing: number; } @@ -337,16 +337,16 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0})) as BuildPubSubRecordType, >buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0})) as BuildPubSubRecordType : BuildPubSubRecordType ->buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0})) : BuildPubSubRecordType +>buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0})) : BuildPubSubRecordType & Writable<{ maxMsToWaitBeforePublishing: 0; }>> >buildPubSubRecordType : (soFar: SO_FAR) => BuildPubSubRecordType ->Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0}) : SO_FAR & { maxMsToWaitBeforePublishing: number; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0}) : Writable & Writable<{ maxMsToWaitBeforePublishing: 0; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >{} : {} >soFar : SO_FAR ->{maxMsToWaitBeforePublishing: 0} : { maxMsToWaitBeforePublishing: number; } ->maxMsToWaitBeforePublishing : number +>{maxMsToWaitBeforePublishing: 0} : { maxMsToWaitBeforePublishing: 0; } +>maxMsToWaitBeforePublishing : 0 >0 : 0 >maxMsToWaitBeforePublishing : 0 } @@ -441,9 +441,9 @@ export enum PubSubRecordIsStoredInRedisAsA { >soFar : SO_FAR >Object.assign( {}, buildNameFieldConstructor(soFar), buildIdentifierFieldConstructor(soFar), buildRecordFieldConstructor(soFar), buildStoredAsConstructor(soFar), buildMaxMsToWaitBeforePublishingFieldConstructor(soFar), buildType(soFar) ) as BuildPubSubRecordType : BuildPubSubRecordType >Object.assign( {}, buildNameFieldConstructor(soFar), buildIdentifierFieldConstructor(soFar), buildRecordFieldConstructor(soFar), buildStoredAsConstructor(soFar), buildMaxMsToWaitBeforePublishingFieldConstructor(soFar), buildType(soFar) ) : any ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } {}, >{} : {} diff --git a/tests/baselines/reference/declarationEmitObjectAssignedDefaultExport.symbols b/tests/baselines/reference/declarationEmitObjectAssignedDefaultExport.symbols index 659edb5ddca3c..981f13e3820d6 100644 --- a/tests/baselines/reference/declarationEmitObjectAssignedDefaultExport.symbols +++ b/tests/baselines/reference/declarationEmitObjectAssignedDefaultExport.symbols @@ -113,9 +113,9 @@ export const C = styled.div``; >div : Symbol(StyledInterface.div, Decl(index.d.ts, 12, 34)) export default Object.assign(A, { ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >A : Symbol(A, Decl(index.ts, 2, 5)) B, diff --git a/tests/baselines/reference/declarationEmitObjectAssignedDefaultExport.types b/tests/baselines/reference/declarationEmitObjectAssignedDefaultExport.types index 9d05d21a2fdd6..acc7ad58c4137 100644 --- a/tests/baselines/reference/declarationEmitObjectAssignedDefaultExport.types +++ b/tests/baselines/reference/declarationEmitObjectAssignedDefaultExport.types @@ -77,10 +77,10 @@ export const C = styled.div``; >`` : "" export default Object.assign(A, { ->Object.assign(A, { B, C}) : string & import("tests/cases/compiler/node_modules/styled-components/index").StyledComponentBase<"div", import("tests/cases/compiler/node_modules/styled-components/index").DefaultTheme, {}, never> & import("tests/cases/compiler/node_modules/styled-components/node_modules/hoist-non-react-statics/index").NonReactStatics<"div"> & { B: import("tests/cases/compiler/node_modules/styled-components/index").StyledComponent<"div", import("tests/cases/compiler/node_modules/styled-components/index").DefaultTheme, {}, never>; C: import("tests/cases/compiler/node_modules/styled-components/index").StyledComponent<"div", import("tests/cases/compiler/node_modules/styled-components/index").DefaultTheme, {}, never>; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign(A, { B, C}) : string & import("tests/cases/compiler/node_modules/styled-components/index").StyledComponentBase<"div", import("tests/cases/compiler/node_modules/styled-components/index").DefaultTheme, {}, never> & import("tests/cases/compiler/node_modules/styled-components/node_modules/hoist-non-react-statics/index").NonReactStatics<"div"> & Writable<{ B: import("tests/cases/compiler/node_modules/styled-components/index").StyledComponent<"div", import("tests/cases/compiler/node_modules/styled-components/index").DefaultTheme, {}, never>; C: import("tests/cases/compiler/node_modules/styled-components/index").StyledComponent<"div", import("tests/cases/compiler/node_modules/styled-components/index").DefaultTheme, {}, never>; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >A : import("tests/cases/compiler/node_modules/styled-components/index").StyledComponent<"div", import("tests/cases/compiler/node_modules/styled-components/index").DefaultTheme, {}, never> >{ B, C} : { B: import("tests/cases/compiler/node_modules/styled-components/index").StyledComponent<"div", import("tests/cases/compiler/node_modules/styled-components/index").DefaultTheme, {}, never>; C: import("tests/cases/compiler/node_modules/styled-components/index").StyledComponent<"div", import("tests/cases/compiler/node_modules/styled-components/index").DefaultTheme, {}, never>; } diff --git a/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.js b/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.js index 837fe49b428d3..a387ceede2b8a 100644 --- a/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.js +++ b/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.js @@ -94,43 +94,43 @@ void p3.result.three; //// [declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.d.ts] export type Key = keyof U; export type Value, U> = U[K]; -export declare const updateIfChanged: (t: T) => ((key: K) => (>(key: K_1) => (>>(key: K_2) => (>>>(key: K_3) => (>>>>(key: K_4) => (>>>>>(key: K_5) => (>>>>>>(key: K_6) => (>>>>>>>(key: K_7) => (>>>>>>>>(key: K_8) => (>>>>>>>>>(key: K_9) => (>>>>>>>>>>(key: K_10) => any & { +export declare const updateIfChanged: (t: T) => ((key: K) => (>(key: K_1) => (>>(key: K_2) => (>>>(key: K_3) => (>>>>(key: K_4) => (>>>>>(key: K_5) => (>>>>>>(key: K_6) => (>>>>>>>(key: K_7) => (>>>>>>>>(key: K_8) => (>>>>>>>>>(key: K_9) => (>>>>>>>>>>(key: K_10) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; -}) & { +}>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; -}) & { +}>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; -}) & { +}>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; -}) & { +}>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; -}) & { +}>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; -}) & { +}>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; -}) & { +}>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; -}) & { +}>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; -}) & { +}>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; -}) & { +}>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; -}) & { +}>) & Writable<{ map: (updater: (u: T) => T) => T; set: (newU: T) => T; -}; +}>; export declare const testRecFun: (parent: T) => { result: T; deeper: (child: U) => { diff --git a/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.symbols b/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.symbols index 08c4eccca0829..bfbdd6084157c 100644 --- a/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.symbols +++ b/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.symbols @@ -47,9 +47,9 @@ export const updateIfChanged = (t: T) => { >newU : Symbol(newU, Decl(declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.ts, 8, 21)) return Object.assign( ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >(key: K) => >K : Symbol(K, Decl(declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.ts, 10, 13)) @@ -76,9 +76,9 @@ export const updateIfChanged = (t: T) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); >update : Symbol(update, Decl(declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.ts, 7, 28)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --)) >Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.types b/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.types index 4e4bf5b76933a..1bef7f2379546 100644 --- a/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.types +++ b/tests/baselines/reference/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.types @@ -10,13 +10,13 @@ export type Value, U> = U[K]; >Value : Value export const updateIfChanged = (t: T) => { ->updateIfChanged : (t: T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }) & { map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }) & { map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }) & { map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }) & { map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }) & { map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }) & { map: (updater: (u: T) => T) => T; set: (newU: T) => T; } ->(t: T) => { const reduce = (u: U, update: (u: U) => T) => { const set = (newU: U) => Object.is(u, newU) ? t : update(newU); return Object.assign( >(key: K) => reduce>(u[key as keyof U] as Value, (v: Value) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }), { map: (updater: (u: U) => U) => set(updater(u)), set }); }; return reduce(t, (t: T) => t);} : (t: T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }) & { map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }) & { map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }) & { map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }) & { map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }) & { map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }) & { map: (updater: (u: T) => T) => T; set: (newU: T) => T; } +>updateIfChanged : (t: T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }>) & Writable<{ map: (updater: (u: T) => T) => T; set: (newU: T) => T; }> +>(t: T) => { const reduce = (u: U, update: (u: U) => T) => { const set = (newU: U) => Object.is(u, newU) ? t : update(newU); return Object.assign( >(key: K) => reduce>(u[key as keyof U] as Value, (v: Value) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }), { map: (updater: (u: U) => U) => set(updater(u)), set }); }; return reduce(t, (t: T) => t);} : (t: T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }>) & Writable<{ map: (updater: (u: T) => T) => T; set: (newU: T) => T; }> >t : T const reduce = (u: U, update: (u: U) => T) => { ->reduce : (u: U, update: (u: U) => T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }) & { map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }) & { map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }) & { map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }) & { map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }) & { map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; } ->(u: U, update: (u: U) => T) => { const set = (newU: U) => Object.is(u, newU) ? t : update(newU); return Object.assign( >(key: K) => reduce>(u[key as keyof U] as Value, (v: Value) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }), { map: (updater: (u: U) => U) => set(updater(u)), set }); } : (u: U, update: (u: U) => T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }) & { map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }) & { map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }) & { map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }) & { map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }) & { map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; } +>reduce : (u: U, update: (u: U) => T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }>) & Writable<{ map: (updater: (u: U) => U) => T; set: (newU: U) => T; }> +>(u: U, update: (u: U) => T) => { const set = (newU: U) => Object.is(u, newU) ? t : update(newU); return Object.assign( >(key: K) => reduce>(u[key as keyof U] as Value, (v: Value) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }), { map: (updater: (u: U) => U) => set(updater(u)), set }); } : (u: U, update: (u: U) => T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }>) & Writable<{ map: (updater: (u: U) => U) => T; set: (newU: U) => T; }> >u : U >update : (u: U) => T >u : U @@ -38,18 +38,18 @@ export const updateIfChanged = (t: T) => { >newU : U return Object.assign( ->Object.assign( >(key: K) => reduce>(u[key as keyof U] as Value, (v: Value) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }), { map: (updater: (u: U) => U) => set(updater(u)), set }) : ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }) & { map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }) & { map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }) & { map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }) & { map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }) & { map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign( >(key: K) => reduce>(u[key as keyof U] as Value, (v: Value) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }), { map: (updater: (u: U) => U) => set(updater(u)), set }) : ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }>) & Writable<{ map: (updater: (u: U) => U) => T; set: (newU: U) => T; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >(key: K) => ->>(key: K) => reduce>(u[key as keyof U] as Value, (v: Value) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }) : (key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }) & { map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }) & { map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }) & { map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }) & { map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }) & { map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; } +>>(key: K) => reduce>(u[key as keyof U] as Value, (v: Value) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }) : (key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }> >key : K reduce>(u[key as keyof U] as Value, (v: Value) => { ->reduce>(u[key as keyof U] as Value, (v: Value) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }) : (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => (>>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value>>>>>>>>>>>) => Value>>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }) & { map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }) & { map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }) & { map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }) & { map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }) & { map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; } ->reduce : (u: U, update: (u: U) => T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }) & { map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }) & { map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }) & { map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }) & { map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }) & { map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; } +>reduce>(u[key as keyof U] as Value, (v: Value) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }) : (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => (>>>>>>>>>>>(key: K) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>>) => Value>>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }> +>reduce : (u: U, update: (u: U) => T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }>) & Writable<{ map: (updater: (u: U) => U) => T; set: (newU: U) => T; }> >u[key as keyof U] as Value : Value >u[key as keyof U] : U[keyof U] >u : U @@ -61,10 +61,10 @@ export const updateIfChanged = (t: T) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); >update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })) : T >update : (u: U) => T ->Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v }) : U & { [x: string]: Value; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v }) : Writable & Writable<{ [x: string]: Value; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Array.isArray(u) ? [] : {} : undefined[] | {} >Array.isArray(u) : boolean >Array.isArray : (arg: any) => arg is any[] @@ -95,8 +95,8 @@ export const updateIfChanged = (t: T) => { }; return reduce(t, (t: T) => t); ->reduce(t, (t: T) => t) : ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }) & { map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }) & { map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }) & { map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }) & { map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }) & { map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }) & { map: (updater: (u: T) => T) => T; set: (newU: T) => T; } ->reduce : (u: U, update: (u: U) => T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }) & { map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }) & { map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }) & { map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }) & { map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }) & { map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }) & { map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; } +>reduce(t, (t: T) => t) : ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }>) & Writable<{ map: (updater: (u: T) => T) => T; set: (newU: T) => T; }> +>reduce : (u: U, update: (u: U) => T) => ((key: K) => (>(key: K) => (>>(key: K) => (>>>(key: K) => (>>>>(key: K) => (>>>>>(key: K) => (>>>>>>(key: K) => (>>>>>>>(key: K) => (>>>>>>>>(key: K) => (>>>>>>>>>(key: K) => (>>>>>>>>>>(key: K) => any & Writable<{ map: (updater: (u: Value>>>>>>>>>>) => Value>>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>>) => Value>>>>>>>>>) => T; set: (newU: Value>>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>>) => Value>>>>>>>>) => T; set: (newU: Value>>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>>) => Value>>>>>>>) => T; set: (newU: Value>>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>>) => Value>>>>>>) => T; set: (newU: Value>>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>>) => Value>>>>>) => T; set: (newU: Value>>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>>) => Value>>>>) => T; set: (newU: Value>>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>>) => Value>>>) => T; set: (newU: Value>>>) => T; }>) & Writable<{ map: (updater: (u: Value>>) => Value>>) => T; set: (newU: Value>>) => T; }>) & Writable<{ map: (updater: (u: Value>) => Value>) => T; set: (newU: Value>) => T; }>) & Writable<{ map: (updater: (u: Value) => Value) => T; set: (newU: Value) => T; }>) & Writable<{ map: (updater: (u: U) => U) => T; set: (newU: U) => T; }> >t : T >(t: T) => t : (t: T) => T >t : T diff --git a/tests/baselines/reference/duplicateNumericIndexers.errors.txt b/tests/baselines/reference/duplicateNumericIndexers.errors.txt index 826a48d1c815b..2238bfad3a4dc 100644 --- a/tests/baselines/reference/duplicateNumericIndexers.errors.txt +++ b/tests/baselines/reference/duplicateNumericIndexers.errors.txt @@ -10,8 +10,8 @@ tests/cases/conformance/types/members/duplicateNumericIndexers.ts(24,5): error T tests/cases/conformance/types/members/duplicateNumericIndexers.ts(25,5): error TS2374: Duplicate index signature for type 'number'. tests/cases/conformance/types/members/duplicateNumericIndexers.ts(29,5): error TS2374: Duplicate index signature for type 'number'. tests/cases/conformance/types/members/duplicateNumericIndexers.ts(30,5): error TS2374: Duplicate index signature for type 'number'. -lib.es5.d.ts(520,5): error TS2374: Duplicate index signature for type 'number'. -lib.es5.d.ts(1484,5): error TS2374: Duplicate index signature for type 'number'. +lib.es5.d.ts(538,5): error TS2374: Duplicate index signature for type 'number'. +lib.es5.d.ts(1502,5): error TS2374: Duplicate index signature for type 'number'. ==== tests/cases/conformance/types/members/duplicateNumericIndexers.ts (12 errors) ==== diff --git a/tests/baselines/reference/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types b/tests/baselines/reference/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types index c566d1897b08d..cf4beacdfc810 100644 --- a/tests/baselines/reference/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types +++ b/tests/baselines/reference/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types @@ -14,9 +14,9 @@ module.exports = 12; Object.defineProperty(module, "exports", { value: "oh no" }); >Object.defineProperty(module, "exports", { value: "oh no" }) : typeof module ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module : typeof module >"exports" : "exports" >{ value: "oh no" } : { value: string; } @@ -59,9 +59,9 @@ B.NS = require("./namespacey"); Object.defineProperty(B, "NS", { value: "why though", writable: true }); >Object.defineProperty(B, "NS", { value: "why though", writable: true }) : typeof B ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >B : typeof B >"NS" : "NS" >{ value: "why though", writable: true } : { value: string; writable: true; } diff --git a/tests/baselines/reference/es2018ObjectAssign.symbols b/tests/baselines/reference/es2018ObjectAssign.symbols index 3ed140cb570d3..3f27f2158d345 100644 --- a/tests/baselines/reference/es2018ObjectAssign.symbols +++ b/tests/baselines/reference/es2018ObjectAssign.symbols @@ -1,9 +1,9 @@ === tests/cases/compiler/es2018ObjectAssign.ts === const test = Object.assign({}, { test: true }); >test : Symbol(test, Decl(es2018ObjectAssign.ts, 0, 5)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >test : Symbol(test, Decl(es2018ObjectAssign.ts, 0, 32)) declare const p: Promise; diff --git a/tests/baselines/reference/es2018ObjectAssign.types b/tests/baselines/reference/es2018ObjectAssign.types index e8cc1927c5caf..7e85abc8fe285 100644 --- a/tests/baselines/reference/es2018ObjectAssign.types +++ b/tests/baselines/reference/es2018ObjectAssign.types @@ -1,10 +1,10 @@ === tests/cases/compiler/es2018ObjectAssign.ts === const test = Object.assign({}, { test: true }); ->test : { test: boolean; } ->Object.assign({}, { test: true }) : { test: boolean; } ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>test : Writable<{ test: boolean; }> +>Object.assign({}, { test: true }) : Writable<{ test: boolean; }> +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >{} : {} >{ test: true } : { test: true; } >test : true diff --git a/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.types b/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.types index 79e54575127f7..8845f1a09b15a 100644 --- a/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.types +++ b/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.types @@ -307,9 +307,9 @@ export class IterableWeakMap implements WeakMap { Object.defineProperties(IterableWeakMap.prototype, { >Object.defineProperties(IterableWeakMap.prototype, { [Symbol.iterator]: { configurable: true, enumerable: false, writable: true, value: Object.getOwnPropertyDescriptor( IterableWeakMap.prototype, "entries", )!.value, }, [Symbol.toStringTag]: { configurable: true, enumerable: false, writable: false, value: "IterableWeakMap", },}) : IterableWeakMap ->Object.defineProperties : (o: T, properties: PropertyDescriptorMap & ThisType) => T +>Object.defineProperties : (o: T, properties: PropertyDescriptorMap & ThisType) => T >Object : ObjectConstructor ->defineProperties : (o: T, properties: PropertyDescriptorMap & ThisType) => T +>defineProperties : (o: T, properties: PropertyDescriptorMap & ThisType) => T >IterableWeakMap.prototype : IterableWeakMap >IterableWeakMap : typeof IterableWeakMap >prototype : IterableWeakMap @@ -339,9 +339,9 @@ Object.defineProperties(IterableWeakMap.prototype, { >Object.getOwnPropertyDescriptor( IterableWeakMap.prototype, "entries", )!.value : any >Object.getOwnPropertyDescriptor( IterableWeakMap.prototype, "entries", )! : PropertyDescriptor >Object.getOwnPropertyDescriptor( IterableWeakMap.prototype, "entries", ) : PropertyDescriptor | undefined ->Object.getOwnPropertyDescriptor : (o: any, p: PropertyKey) => PropertyDescriptor | undefined +>Object.getOwnPropertyDescriptor : (o: {}, p: PropertyKey) => PropertyDescriptor | undefined >Object : ObjectConstructor ->getOwnPropertyDescriptor : (o: any, p: PropertyKey) => PropertyDescriptor | undefined +>getOwnPropertyDescriptor : (o: {}, p: PropertyKey) => PropertyDescriptor | undefined IterableWeakMap.prototype, >IterableWeakMap.prototype : IterableWeakMap diff --git a/tests/baselines/reference/excessPropertyCheckWithEmptyObject.types b/tests/baselines/reference/excessPropertyCheckWithEmptyObject.types index 3c748f7fd923b..6e19f04737b72 100644 --- a/tests/baselines/reference/excessPropertyCheckWithEmptyObject.types +++ b/tests/baselines/reference/excessPropertyCheckWithEmptyObject.types @@ -4,9 +4,9 @@ // Excess property error expected here Object.defineProperty(window, "prop", { value: "v1.0.0", readonly: false }); >Object.defineProperty(window, "prop", { value: "v1.0.0", readonly: false }) : Window & typeof globalThis ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >window : Window & typeof globalThis >"prop" : "prop" >{ value: "v1.0.0", readonly: false } : { value: string; readonly: boolean; } diff --git a/tests/baselines/reference/getterSetterNonAccessor.types b/tests/baselines/reference/getterSetterNonAccessor.types index 5f9a658b575f0..b81b5a6dcad1d 100644 --- a/tests/baselines/reference/getterSetterNonAccessor.types +++ b/tests/baselines/reference/getterSetterNonAccessor.types @@ -9,9 +9,9 @@ function setFunc(v){} Object.defineProperty({}, "0", ({ >Object.defineProperty({}, "0", ({ get: getFunc, set: setFunc, configurable: true })) : {} ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >{} : {} >"0" : "0" >({ get: getFunc, set: setFunc, configurable: true }) : PropertyDescriptor diff --git a/tests/baselines/reference/importAliasModuleExports.types b/tests/baselines/reference/importAliasModuleExports.types index 2067e8b8d74e4..982fbb7cfba05 100644 --- a/tests/baselines/reference/importAliasModuleExports.types +++ b/tests/baselines/reference/importAliasModuleExports.types @@ -42,9 +42,9 @@ A.prototype.func = function() { this._func = 0; } Object.defineProperty(A.prototype, "def", { value: 0 }); >Object.defineProperty(A.prototype, "def", { value: 0 }) : A ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >A.prototype : A >A : typeof A >prototype : A diff --git a/tests/baselines/reference/intersectionsAndEmptyObjects.symbols b/tests/baselines/reference/intersectionsAndEmptyObjects.symbols index 7158ee012b987..83d3e6abe116b 100644 --- a/tests/baselines/reference/intersectionsAndEmptyObjects.symbols +++ b/tests/baselines/reference/intersectionsAndEmptyObjects.symbols @@ -116,9 +116,9 @@ const intersectDictionaries = ( ): F1 & F2 => Object.assign({}, d1, d2); >F1 : Symbol(F1, Decl(intersectionsAndEmptyObjects.ts, 30, 31)) >F2 : Symbol(F2, Decl(intersectionsAndEmptyObjects.ts, 30, 53)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >d1 : Symbol(d1, Decl(intersectionsAndEmptyObjects.ts, 30, 77)) >d2 : Symbol(d2, Decl(intersectionsAndEmptyObjects.ts, 31, 9)) diff --git a/tests/baselines/reference/intersectionsAndEmptyObjects.types b/tests/baselines/reference/intersectionsAndEmptyObjects.types index fc28f024e45e9..3d6a9caac238b 100644 --- a/tests/baselines/reference/intersectionsAndEmptyObjects.types +++ b/tests/baselines/reference/intersectionsAndEmptyObjects.types @@ -75,10 +75,10 @@ const intersectDictionaries = ( >d2 : F2 ): F1 & F2 => Object.assign({}, d1, d2); ->Object.assign({}, d1, d2) : {} & F1 & F2 ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign({}, d1, d2) : Writable & Writable +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >{} : {} >d1 : F1 >d2 : F2 diff --git a/tests/baselines/reference/javascriptDefinePropertyPrototypeNonConstructor.types b/tests/baselines/reference/javascriptDefinePropertyPrototypeNonConstructor.types index 7dbd38d69dffa..834380deb4edf 100644 --- a/tests/baselines/reference/javascriptDefinePropertyPrototypeNonConstructor.types +++ b/tests/baselines/reference/javascriptDefinePropertyPrototypeNonConstructor.types @@ -5,9 +5,9 @@ function Graphic() { Object.defineProperty(Graphic.prototype, "instance", { >Object.defineProperty(Graphic.prototype, "instance", { get: function() { return this; }}) : any ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Graphic.prototype : any >Graphic : typeof Graphic >prototype : any diff --git a/tests/baselines/reference/jsCheckObjectDefineThisNoCrash.types b/tests/baselines/reference/jsCheckObjectDefineThisNoCrash.types index e175b0527772f..00acd0d924652 100644 --- a/tests/baselines/reference/jsCheckObjectDefineThisNoCrash.types +++ b/tests/baselines/reference/jsCheckObjectDefineThisNoCrash.types @@ -6,9 +6,9 @@ class C { // Neither of the following should be recognized as declarations yet Object.defineProperty(this, "_prop", { value: {} }); >Object.defineProperty(this, "_prop", { value: {} }) : this ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >this : this >"_prop" : "_prop" >{ value: {} } : { value: {}; } @@ -17,9 +17,9 @@ class C { Object.defineProperty(this._prop, "num", { value: 12 }); >Object.defineProperty(this._prop, "num", { value: 12 }) : any ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >this._prop : any >this : this >_prop : any diff --git a/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.types b/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.types index fc664ec5d19a6..3bbfde8ecf84d 100644 --- a/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.types +++ b/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.types @@ -1,9 +1,9 @@ === tests/cases/conformance/jsdoc/declarations/index.js === Object.defineProperty(module.exports, "a", { value: function a() {} }); >Object.defineProperty(module.exports, "a", { value: function a() {} }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -15,9 +15,9 @@ Object.defineProperty(module.exports, "a", { value: function a() {} }); Object.defineProperty(module.exports, "b", { value: function b() {} }); >Object.defineProperty(module.exports, "b", { value: function b() {} }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -29,9 +29,9 @@ Object.defineProperty(module.exports, "b", { value: function b() {} }); Object.defineProperty(module.exports.b, "cat", { value: "cat" }); >Object.defineProperty(module.exports.b, "cat", { value: "cat" }) : () => void ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports.b : () => void >module.exports : typeof module.exports >module : { exports: typeof module.exports; } @@ -56,9 +56,9 @@ function d(a, b) { return /** @type {*} */(null); } Object.defineProperty(module.exports, "d", { value: d }); >Object.defineProperty(module.exports, "d", { value: d }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -83,9 +83,9 @@ function e(a, b) { return /** @type {*} */(null); } Object.defineProperty(module.exports, "e", { value: e }); >Object.defineProperty(module.exports, "e", { value: e }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -107,9 +107,9 @@ function f(a) { } Object.defineProperty(module.exports, "f", { value: f }); >Object.defineProperty(module.exports, "f", { value: f }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -120,9 +120,9 @@ Object.defineProperty(module.exports, "f", { value: f }); Object.defineProperty(module.exports.f, "self", { value: module.exports.f }); >Object.defineProperty(module.exports.f, "self", { value: module.exports.f }) : (a: T) => T ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports.f : (a: T) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } @@ -158,9 +158,9 @@ function g(a, b) { } Object.defineProperty(module.exports, "g", { value: g }); >Object.defineProperty(module.exports, "g", { value: g }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -191,9 +191,9 @@ function hh(a, b) { } Object.defineProperty(module.exports, "h", { value: hh }); >Object.defineProperty(module.exports, "h", { value: hh }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -204,9 +204,9 @@ Object.defineProperty(module.exports, "h", { value: hh }); Object.defineProperty(module.exports, "i", { value: function i(){} }); >Object.defineProperty(module.exports, "i", { value: function i(){} }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -218,9 +218,9 @@ Object.defineProperty(module.exports, "i", { value: function i(){} }); Object.defineProperty(module.exports, "ii", { value: module.exports.i }); >Object.defineProperty(module.exports, "ii", { value: module.exports.i }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -236,9 +236,9 @@ Object.defineProperty(module.exports, "ii", { value: module.exports.i }); // note that this last one doesn't make much sense in cjs, since exports aren't hoisted bindings Object.defineProperty(module.exports, "jj", { value: module.exports.j }); >Object.defineProperty(module.exports, "jj", { value: module.exports.j }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -253,9 +253,9 @@ Object.defineProperty(module.exports, "jj", { value: module.exports.j }); Object.defineProperty(module.exports, "j", { value: function j() {} }); >Object.defineProperty(module.exports, "j", { value: function j() {} }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports diff --git a/tests/baselines/reference/jsDeclarationsGetterSetter.types b/tests/baselines/reference/jsDeclarationsGetterSetter.types index 146600cc4151e..aa064fb2d5be8 100644 --- a/tests/baselines/reference/jsDeclarationsGetterSetter.types +++ b/tests/baselines/reference/jsDeclarationsGetterSetter.types @@ -42,9 +42,9 @@ export class D {} Object.defineProperty(D.prototype, "x", { >Object.defineProperty(D.prototype, "x", { get() { return 12; }}) : D ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >D.prototype : D >D : typeof D >prototype : D @@ -64,9 +64,9 @@ export class E {} Object.defineProperty(E.prototype, "x", { >Object.defineProperty(E.prototype, "x", { /** * @param {number} _arg */ set(_arg) {}}) : E ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >E.prototype : E >E : typeof E >prototype : E @@ -87,9 +87,9 @@ export class F {} Object.defineProperty(F.prototype, "x", { >Object.defineProperty(F.prototype, "x", { get() { return 12; }, /** * @param {number} _arg */ set(_arg) {}}) : F ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >F.prototype : F >F : typeof F >prototype : F diff --git a/tests/baselines/reference/jsExpandoObjectDefineProperty.types b/tests/baselines/reference/jsExpandoObjectDefineProperty.types index fb25ede2da462..d1c059915ea2e 100644 --- a/tests/baselines/reference/jsExpandoObjectDefineProperty.types +++ b/tests/baselines/reference/jsExpandoObjectDefineProperty.types @@ -5,9 +5,9 @@ var chrome = {} Object.defineProperty(chrome, 'devtools', { value: {}, enumerable: true }) >Object.defineProperty(chrome, 'devtools', { value: {}, enumerable: true }) : typeof chrome ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >chrome : typeof chrome >'devtools' : "devtools" >{ value: {}, enumerable: true } : { value: {}; enumerable: true; } diff --git a/tests/baselines/reference/jsFileESModuleWithEnumTag.types b/tests/baselines/reference/jsFileESModuleWithEnumTag.types index 4ecc2d0fdd6a5..57bf39e14d499 100644 --- a/tests/baselines/reference/jsFileESModuleWithEnumTag.types +++ b/tests/baselines/reference/jsFileESModuleWithEnumTag.types @@ -34,9 +34,9 @@ ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = 'Default'; Object.defineProperty(ChangeDetectionStrategy, "aField", {value: 42}); >Object.defineProperty(ChangeDetectionStrategy, "aField", {value: 42}) : { OnPush: number; Default: number; } ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >ChangeDetectionStrategy : { OnPush: number; Default: number; } >"aField" : "aField" >{value: 42} : { value: number; } diff --git a/tests/baselines/reference/lateBoundAssignmentDeclarationSupport3.types b/tests/baselines/reference/lateBoundAssignmentDeclarationSupport3.types index 7f6c8d2c42ada..f04edbf31e6c5 100644 --- a/tests/baselines/reference/lateBoundAssignmentDeclarationSupport3.types +++ b/tests/baselines/reference/lateBoundAssignmentDeclarationSupport3.types @@ -32,9 +32,9 @@ const _str = "my-fake-sym"; Object.defineProperty(module.exports, _sym, { value: "ok" }); >Object.defineProperty(module.exports, _sym, { value: "ok" }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports @@ -45,9 +45,9 @@ Object.defineProperty(module.exports, _sym, { value: "ok" }); Object.defineProperty(module.exports, _str, { value: "ok" }); >Object.defineProperty(module.exports, _str, { value: "ok" }) : typeof module.exports ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >module.exports : typeof module.exports >module : { exports: typeof module.exports; } >exports : typeof module.exports diff --git a/tests/baselines/reference/lateBoundAssignmentDeclarationSupport6.types b/tests/baselines/reference/lateBoundAssignmentDeclarationSupport6.types index 754ff5f67dbfe..fb697a9cfdc79 100644 --- a/tests/baselines/reference/lateBoundAssignmentDeclarationSupport6.types +++ b/tests/baselines/reference/lateBoundAssignmentDeclarationSupport6.types @@ -51,9 +51,9 @@ F.prototype.defsAClass = true; Object.defineProperty(F.prototype, _str, {value: "ok"}); >Object.defineProperty(F.prototype, _str, {value: "ok"}) : any ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >F.prototype : any >F : typeof F >prototype : any @@ -64,9 +64,9 @@ Object.defineProperty(F.prototype, _str, {value: "ok"}); Object.defineProperty(F.prototype, _sym, {value: "ok"}); >Object.defineProperty(F.prototype, _sym, {value: "ok"}) : any ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >F.prototype : any >F : typeof F >prototype : any diff --git a/tests/baselines/reference/objectFromEntries.types b/tests/baselines/reference/objectFromEntries.types index 9812b4ae90c4b..a8921ba8418c4 100644 --- a/tests/baselines/reference/objectFromEntries.types +++ b/tests/baselines/reference/objectFromEntries.types @@ -1,10 +1,10 @@ === tests/cases/compiler/objectFromEntries.ts === const o = Object.fromEntries([['a', 1], ['b', 2], ['c', 3]]); ->o : { [k: string]: number; } ->Object.fromEntries([['a', 1], ['b', 2], ['c', 3]]) : { [k: string]: number; } ->Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>o : { [k: string]: number; [k: number]: number; [k: symbol]: number; } +>Object.fromEntries([['a', 1], ['b', 2], ['c', 3]]) : { [k: string]: number; [k: number]: number; [k: symbol]: number; } +>Object.fromEntries : { (entries: Iterable): { [k: string]: T; [k: number]: T; [k: symbol]: T; }; (entries: Iterable): any; } >Object : ObjectConstructor ->fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>fromEntries : { (entries: Iterable): { [k: string]: T; [k: number]: T; [k: symbol]: T; }; (entries: Iterable): any; } >[['a', 1], ['b', 2], ['c', 3]] : [string, number][] >['a', 1] : [string, number] >'a' : "a" @@ -17,20 +17,20 @@ const o = Object.fromEntries([['a', 1], ['b', 2], ['c', 3]]); >3 : 3 const o2 = Object.fromEntries(new URLSearchParams()); ->o2 : { [k: string]: string; } ->Object.fromEntries(new URLSearchParams()) : { [k: string]: string; } ->Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>o2 : { [k: string]: string; [k: number]: string; [k: symbol]: string; } +>Object.fromEntries(new URLSearchParams()) : { [k: string]: string; [k: number]: string; [k: symbol]: string; } +>Object.fromEntries : { (entries: Iterable): { [k: string]: T; [k: number]: T; [k: symbol]: T; }; (entries: Iterable): any; } >Object : ObjectConstructor ->fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>fromEntries : { (entries: Iterable): { [k: string]: T; [k: number]: T; [k: symbol]: T; }; (entries: Iterable): any; } >new URLSearchParams() : URLSearchParams >URLSearchParams : { new (init?: string | URLSearchParams | string[][] | Record): URLSearchParams; prototype: URLSearchParams; toString(): string; } const o3 = Object.fromEntries(new Map([[Symbol("key"), "value"]])); ->o3 : { [k: string]: string; } ->Object.fromEntries(new Map([[Symbol("key"), "value"]])) : { [k: string]: string; } ->Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>o3 : { [k: string]: string; [k: number]: string; [k: symbol]: string; } +>Object.fromEntries(new Map([[Symbol("key"), "value"]])) : { [k: string]: string; [k: number]: string; [k: symbol]: string; } +>Object.fromEntries : { (entries: Iterable): { [k: string]: T; [k: number]: T; [k: symbol]: T; }; (entries: Iterable): any; } >Object : ObjectConstructor ->fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>fromEntries : { (entries: Iterable): { [k: string]: T; [k: number]: T; [k: symbol]: T; }; (entries: Iterable): any; } >new Map([[Symbol("key"), "value"]]) : Map >Map : MapConstructor >[[Symbol("key"), "value"]] : [symbol, string][] @@ -60,9 +60,9 @@ const frozenArray = Object.freeze([['a', 1], ['b', 2], ['c', 3]]); const o4 = Object.fromEntries(frozenArray); >o4 : any >Object.fromEntries(frozenArray) : any ->Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>Object.fromEntries : { (entries: Iterable): { [k: string]: T; [k: number]: T; [k: symbol]: T; }; (entries: Iterable): any; } >Object : ObjectConstructor ->fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>fromEntries : { (entries: Iterable): { [k: string]: T; [k: number]: T; [k: symbol]: T; }; (entries: Iterable): any; } >frozenArray : readonly (string | number)[][] const frozenArray2: readonly [string, number][] = Object.freeze([['a', 1], ['b', 2], ['c', 3]]); @@ -83,10 +83,10 @@ const frozenArray2: readonly [string, number][] = Object.freeze([['a', 1], ['b', >3 : 3 const o5 = Object.fromEntries(frozenArray2); ->o5 : { [k: string]: number; } ->Object.fromEntries(frozenArray2) : { [k: string]: number; } ->Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>o5 : { [k: string]: number; [k: number]: number; [k: symbol]: number; } +>Object.fromEntries(frozenArray2) : { [k: string]: number; [k: number]: number; [k: symbol]: number; } +>Object.fromEntries : { (entries: Iterable): { [k: string]: T; [k: number]: T; [k: symbol]: T; }; (entries: Iterable): any; } >Object : ObjectConstructor ->fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>fromEntries : { (entries: Iterable): { [k: string]: T; [k: number]: T; [k: symbol]: T; }; (entries: Iterable): any; } >frozenArray2 : readonly [string, number][] diff --git a/tests/baselines/reference/objectLitGetterSetter.types b/tests/baselines/reference/objectLitGetterSetter.types index 54c587890f8ac..f70bb3d8a3c9f 100644 --- a/tests/baselines/reference/objectLitGetterSetter.types +++ b/tests/baselines/reference/objectLitGetterSetter.types @@ -5,9 +5,9 @@ Object.defineProperty(obj, "accProperty", ({ >Object.defineProperty(obj, "accProperty", ({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } })) : {} ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >obj : {} >"accProperty" : "accProperty" >({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : PropertyDescriptor diff --git a/tests/baselines/reference/objectMethodNullability.errors.txt b/tests/baselines/reference/objectMethodNullability.errors.txt new file mode 100644 index 0000000000000..570b7e758ea56 --- /dev/null +++ b/tests/baselines/reference/objectMethodNullability.errors.txt @@ -0,0 +1,135 @@ +tests/cases/compiler/objectMethodNullability.ts(3,15): error TS2769: No overload matches this call. + Overload 1 of 5, '(target: {}): {}', gave the following error. + Argument of type 'undefined' is not assignable to parameter of type '{}'. + Overload 2 of 5, '(target: {}, ...sources: any[]): any', gave the following error. + Argument of type 'undefined' is not assignable to parameter of type '{}'. +tests/cases/compiler/objectMethodNullability.ts(4,15): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectMethodNullability.ts(5,25): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object'. +tests/cases/compiler/objectMethodNullability.ts(6,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object'. +tests/cases/compiler/objectMethodNullability.ts(7,16): error TS2769: No overload matches this call. + Overload 1 of 2, '(o: { [s: string]: unknown; } | ArrayLike): [string, unknown][]', gave the following error. + Argument of type 'undefined' is not assignable to parameter of type '{ [s: string]: unknown; } | ArrayLike'. + Overload 2 of 2, '(o: {}): [string, any][]', gave the following error. + Argument of type 'undefined' is not assignable to parameter of type '{}'. +tests/cases/compiler/objectMethodNullability.ts(8,33): error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. +tests/cases/compiler/objectMethodNullability.ts(9,34): error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. +tests/cases/compiler/objectMethodNullability.ts(10,28): error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. +tests/cases/compiler/objectMethodNullability.ts(11,30): error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. +tests/cases/compiler/objectMethodNullability.ts(12,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. +tests/cases/compiler/objectMethodNullability.ts(13,15): error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. +tests/cases/compiler/objectMethodNullability.ts(14,13): error TS2769: No overload matches this call. + Overload 1 of 2, '(o: {}): string[]', gave the following error. + Argument of type 'undefined' is not assignable to parameter of type '{}'. + Overload 2 of 2, '(o: object): string[]', gave the following error. + Argument of type 'undefined' is not assignable to parameter of type 'object'. +tests/cases/compiler/objectMethodNullability.ts(15,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. +tests/cases/compiler/objectMethodNullability.ts(16,15): error TS2769: No overload matches this call. + Overload 1 of 2, '(o: ArrayLike | { [s: string]: unknown; }): unknown[]', gave the following error. + Argument of type 'undefined' is not assignable to parameter of type 'ArrayLike | { [s: string]: unknown; }'. + Overload 2 of 2, '(o: {}): any[]', gave the following error. + Argument of type 'undefined' is not assignable to parameter of type '{}'. +tests/cases/compiler/objectMethodNullability.ts(18,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'. +tests/cases/compiler/objectMethodNullability.ts(19,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'. +tests/cases/compiler/objectMethodNullability.ts(20,23): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'. + + +==== tests/cases/compiler/objectMethodNullability.ts (17 errors) ==== + // All of the following should produce an error: + + Object.assign(undefined); + ~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 5, '(target: {}): {}', gave the following error. +!!! error TS2769: Argument of type 'undefined' is not assignable to parameter of type '{}'. +!!! error TS2769: Overload 2 of 5, '(target: {}, ...sources: any[]): any', gave the following error. +!!! error TS2769: Argument of type 'undefined' is not assignable to parameter of type '{}'. + Object.create(undefined); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'. + Object.defineProperties(undefined, {}); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object'. + Object.defineProperty(undefined, "foo", {}); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object'. + Object.entries(undefined); + ~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(o: { [s: string]: unknown; } | ArrayLike): [string, unknown][]', gave the following error. +!!! error TS2769: Argument of type 'undefined' is not assignable to parameter of type '{ [s: string]: unknown; } | ArrayLike'. +!!! error TS2769: Overload 2 of 2, '(o: {}): [string, any][]', gave the following error. +!!! error TS2769: Argument of type 'undefined' is not assignable to parameter of type '{}'. + Object.getOwnPropertyDescriptor(undefined, "foo"); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. + Object.getOwnPropertyDescriptors(undefined); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. + Object.getOwnPropertyNames(undefined); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. + Object.getOwnPropertySymbols(undefined); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. + Object.getPrototypeOf(undefined); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. + Object.hasOwn(undefined, "foo"); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. + Object.keys(undefined); + ~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(o: {}): string[]', gave the following error. +!!! error TS2769: Argument of type 'undefined' is not assignable to parameter of type '{}'. +!!! error TS2769: Overload 2 of 2, '(o: object): string[]', gave the following error. +!!! error TS2769: Argument of type 'undefined' is not assignable to parameter of type 'object'. + Object.setPrototypeOf(undefined, {}); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type '{}'. + Object.values(undefined); + ~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(o: ArrayLike | { [s: string]: unknown; }): unknown[]', gave the following error. +!!! error TS2769: Argument of type 'undefined' is not assignable to parameter of type 'ArrayLike | { [s: string]: unknown; }'. +!!! error TS2769: Overload 2 of 2, '(o: {}): any[]', gave the following error. +!!! error TS2769: Argument of type 'undefined' is not assignable to parameter of type '{}'. + + Object.create(0); + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'. + Object.defineProperties(0, {}); + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'. + Object.defineProperty(0, "foo", {}); + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'. + + // While the following should not: + + Object.assign(0); + Object.entries(0); + Object.getOwnPropertyDescriptor(0, "foo"); + Object.getOwnPropertyDescriptors(0); + Object.getOwnPropertyNames(0); + Object.getOwnPropertySymbols(0); + Object.getPrototypeOf(0); + Object.hasOwn(0, "foo"); + Object.keys(0); + Object.setPrototypeOf(0, {}); + Object.values(0); + + Object.freeze(undefined); + Object.isExtensible(undefined); + Object.isFrozen(undefined); + Object.isSealed(undefined); + Object.preventExtensions(undefined); + Object.seal(undefined); + + Object.freeze(0); + Object.isExtensible(0); + Object.isFrozen(0); + Object.isSealed(0); + Object.preventExtensions(0); + Object.seal(0); + \ No newline at end of file diff --git a/tests/baselines/reference/objectMethodNullability.js b/tests/baselines/reference/objectMethodNullability.js new file mode 100644 index 0000000000000..0fbc2117922b2 --- /dev/null +++ b/tests/baselines/reference/objectMethodNullability.js @@ -0,0 +1,95 @@ +//// [objectMethodNullability.ts] +// All of the following should produce an error: + +Object.assign(undefined); +Object.create(undefined); +Object.defineProperties(undefined, {}); +Object.defineProperty(undefined, "foo", {}); +Object.entries(undefined); +Object.getOwnPropertyDescriptor(undefined, "foo"); +Object.getOwnPropertyDescriptors(undefined); +Object.getOwnPropertyNames(undefined); +Object.getOwnPropertySymbols(undefined); +Object.getPrototypeOf(undefined); +Object.hasOwn(undefined, "foo"); +Object.keys(undefined); +Object.setPrototypeOf(undefined, {}); +Object.values(undefined); + +Object.create(0); +Object.defineProperties(0, {}); +Object.defineProperty(0, "foo", {}); + +// While the following should not: + +Object.assign(0); +Object.entries(0); +Object.getOwnPropertyDescriptor(0, "foo"); +Object.getOwnPropertyDescriptors(0); +Object.getOwnPropertyNames(0); +Object.getOwnPropertySymbols(0); +Object.getPrototypeOf(0); +Object.hasOwn(0, "foo"); +Object.keys(0); +Object.setPrototypeOf(0, {}); +Object.values(0); + +Object.freeze(undefined); +Object.isExtensible(undefined); +Object.isFrozen(undefined); +Object.isSealed(undefined); +Object.preventExtensions(undefined); +Object.seal(undefined); + +Object.freeze(0); +Object.isExtensible(0); +Object.isFrozen(0); +Object.isSealed(0); +Object.preventExtensions(0); +Object.seal(0); + + +//// [objectMethodNullability.js] +"use strict"; +// All of the following should produce an error: +Object.assign(undefined); +Object.create(undefined); +Object.defineProperties(undefined, {}); +Object.defineProperty(undefined, "foo", {}); +Object.entries(undefined); +Object.getOwnPropertyDescriptor(undefined, "foo"); +Object.getOwnPropertyDescriptors(undefined); +Object.getOwnPropertyNames(undefined); +Object.getOwnPropertySymbols(undefined); +Object.getPrototypeOf(undefined); +Object.hasOwn(undefined, "foo"); +Object.keys(undefined); +Object.setPrototypeOf(undefined, {}); +Object.values(undefined); +Object.create(0); +Object.defineProperties(0, {}); +Object.defineProperty(0, "foo", {}); +// While the following should not: +Object.assign(0); +Object.entries(0); +Object.getOwnPropertyDescriptor(0, "foo"); +Object.getOwnPropertyDescriptors(0); +Object.getOwnPropertyNames(0); +Object.getOwnPropertySymbols(0); +Object.getPrototypeOf(0); +Object.hasOwn(0, "foo"); +Object.keys(0); +Object.setPrototypeOf(0, {}); +Object.values(0); +Object.freeze(undefined); +Object.isExtensible(undefined); +Object.isFrozen(undefined); +Object.isSealed(undefined); +Object.preventExtensions(undefined); +Object.seal(undefined); +Object.freeze(0); +Object.isExtensible(0); +Object.isFrozen(0); +Object.isSealed(0); +Object.preventExtensions(0); +Object.seal(0); diff --git a/tests/baselines/reference/objectMethodNullability.symbols b/tests/baselines/reference/objectMethodNullability.symbols new file mode 100644 index 0000000000000..ee25962e68871 --- /dev/null +++ b/tests/baselines/reference/objectMethodNullability.symbols @@ -0,0 +1,225 @@ +=== tests/cases/compiler/objectMethodNullability.ts === +// All of the following should produce an error: + +Object.assign(undefined); +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.create(undefined); +>Object.create : Symbol(ObjectConstructor.create, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>create : Symbol(ObjectConstructor.create, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.defineProperties(undefined, {}); +>Object.defineProperties : Symbol(ObjectConstructor.defineProperties, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperties : Symbol(ObjectConstructor.defineProperties, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.defineProperty(undefined, "foo", {}); +>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.entries(undefined); +>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, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.getOwnPropertyDescriptor(undefined, "foo"); +>Object.getOwnPropertyDescriptor : Symbol(ObjectConstructor.getOwnPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>getOwnPropertyDescriptor : Symbol(ObjectConstructor.getOwnPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.getOwnPropertyDescriptors(undefined); +>Object.getOwnPropertyDescriptors : Symbol(ObjectConstructor.getOwnPropertyDescriptors, Decl(lib.es2017.object.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>getOwnPropertyDescriptors : Symbol(ObjectConstructor.getOwnPropertyDescriptors, Decl(lib.es2017.object.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.getOwnPropertyNames(undefined); +>Object.getOwnPropertyNames : Symbol(ObjectConstructor.getOwnPropertyNames, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>getOwnPropertyNames : Symbol(ObjectConstructor.getOwnPropertyNames, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.getOwnPropertySymbols(undefined); +>Object.getOwnPropertySymbols : Symbol(ObjectConstructor.getOwnPropertySymbols, Decl(lib.es2015.core.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>getOwnPropertySymbols : Symbol(ObjectConstructor.getOwnPropertySymbols, Decl(lib.es2015.core.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.getPrototypeOf(undefined); +>Object.getPrototypeOf : Symbol(ObjectConstructor.getPrototypeOf, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>getPrototypeOf : Symbol(ObjectConstructor.getPrototypeOf, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.hasOwn(undefined, "foo"); +>Object.hasOwn : Symbol(ObjectConstructor.hasOwn, Decl(lib.es2022.object.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>hasOwn : Symbol(ObjectConstructor.hasOwn, Decl(lib.es2022.object.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.keys(undefined); +>Object.keys : Symbol(ObjectConstructor.keys, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>keys : Symbol(ObjectConstructor.keys, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.setPrototypeOf(undefined, {}); +>Object.setPrototypeOf : Symbol(ObjectConstructor.setPrototypeOf, Decl(lib.es2015.core.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>setPrototypeOf : Symbol(ObjectConstructor.setPrototypeOf, Decl(lib.es2015.core.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.values(undefined); +>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, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.create(0); +>Object.create : Symbol(ObjectConstructor.create, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>create : Symbol(ObjectConstructor.create, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +Object.defineProperties(0, {}); +>Object.defineProperties : Symbol(ObjectConstructor.defineProperties, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperties : Symbol(ObjectConstructor.defineProperties, Decl(lib.es5.d.ts, --, --)) + +Object.defineProperty(0, "foo", {}); +>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) + +// While the following should not: + +Object.assign(0); +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +Object.entries(0); +>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, --, --), Decl(lib.es2017.object.d.ts, --, --)) + +Object.getOwnPropertyDescriptor(0, "foo"); +>Object.getOwnPropertyDescriptor : Symbol(ObjectConstructor.getOwnPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>getOwnPropertyDescriptor : Symbol(ObjectConstructor.getOwnPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) + +Object.getOwnPropertyDescriptors(0); +>Object.getOwnPropertyDescriptors : Symbol(ObjectConstructor.getOwnPropertyDescriptors, Decl(lib.es2017.object.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>getOwnPropertyDescriptors : Symbol(ObjectConstructor.getOwnPropertyDescriptors, Decl(lib.es2017.object.d.ts, --, --)) + +Object.getOwnPropertyNames(0); +>Object.getOwnPropertyNames : Symbol(ObjectConstructor.getOwnPropertyNames, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>getOwnPropertyNames : Symbol(ObjectConstructor.getOwnPropertyNames, Decl(lib.es5.d.ts, --, --)) + +Object.getOwnPropertySymbols(0); +>Object.getOwnPropertySymbols : Symbol(ObjectConstructor.getOwnPropertySymbols, Decl(lib.es2015.core.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>getOwnPropertySymbols : Symbol(ObjectConstructor.getOwnPropertySymbols, Decl(lib.es2015.core.d.ts, --, --)) + +Object.getPrototypeOf(0); +>Object.getPrototypeOf : Symbol(ObjectConstructor.getPrototypeOf, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>getPrototypeOf : Symbol(ObjectConstructor.getPrototypeOf, Decl(lib.es5.d.ts, --, --)) + +Object.hasOwn(0, "foo"); +>Object.hasOwn : Symbol(ObjectConstructor.hasOwn, Decl(lib.es2022.object.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>hasOwn : Symbol(ObjectConstructor.hasOwn, Decl(lib.es2022.object.d.ts, --, --)) + +Object.keys(0); +>Object.keys : Symbol(ObjectConstructor.keys, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>keys : Symbol(ObjectConstructor.keys, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +Object.setPrototypeOf(0, {}); +>Object.setPrototypeOf : Symbol(ObjectConstructor.setPrototypeOf, Decl(lib.es2015.core.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>setPrototypeOf : Symbol(ObjectConstructor.setPrototypeOf, Decl(lib.es2015.core.d.ts, --, --)) + +Object.values(0); +>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, --, --), Decl(lib.es2017.object.d.ts, --, --)) + +Object.freeze(undefined); +>Object.freeze : Symbol(ObjectConstructor.freeze, 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, --, --)) +>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.isExtensible(undefined); +>Object.isExtensible : Symbol(ObjectConstructor.isExtensible, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>isExtensible : Symbol(ObjectConstructor.isExtensible, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.isFrozen(undefined); +>Object.isFrozen : Symbol(ObjectConstructor.isFrozen, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>isFrozen : Symbol(ObjectConstructor.isFrozen, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.isSealed(undefined); +>Object.isSealed : Symbol(ObjectConstructor.isSealed, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>isSealed : Symbol(ObjectConstructor.isSealed, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.preventExtensions(undefined); +>Object.preventExtensions : Symbol(ObjectConstructor.preventExtensions, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>preventExtensions : Symbol(ObjectConstructor.preventExtensions, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.seal(undefined); +>Object.seal : Symbol(ObjectConstructor.seal, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>seal : Symbol(ObjectConstructor.seal, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +Object.freeze(0); +>Object.freeze : Symbol(ObjectConstructor.freeze, 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, --, --)) +>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +Object.isExtensible(0); +>Object.isExtensible : Symbol(ObjectConstructor.isExtensible, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>isExtensible : Symbol(ObjectConstructor.isExtensible, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +Object.isFrozen(0); +>Object.isFrozen : Symbol(ObjectConstructor.isFrozen, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>isFrozen : Symbol(ObjectConstructor.isFrozen, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +Object.isSealed(0); +>Object.isSealed : Symbol(ObjectConstructor.isSealed, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>isSealed : Symbol(ObjectConstructor.isSealed, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +Object.preventExtensions(0); +>Object.preventExtensions : Symbol(ObjectConstructor.preventExtensions, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>preventExtensions : Symbol(ObjectConstructor.preventExtensions, Decl(lib.es5.d.ts, --, --)) + +Object.seal(0); +>Object.seal : Symbol(ObjectConstructor.seal, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>seal : Symbol(ObjectConstructor.seal, Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/objectMethodNullability.types b/tests/baselines/reference/objectMethodNullability.types new file mode 100644 index 0000000000000..8a9d71816061b --- /dev/null +++ b/tests/baselines/reference/objectMethodNullability.types @@ -0,0 +1,297 @@ +=== tests/cases/compiler/objectMethodNullability.ts === +// All of the following should produce an error: + +Object.assign(undefined); +>Object.assign(undefined) : {} +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } +>Object : ObjectConstructor +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } +>undefined : undefined + +Object.create(undefined); +>Object.create(undefined) : any +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType): any; } +>Object : ObjectConstructor +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType): any; } +>undefined : undefined + +Object.defineProperties(undefined, {}); +>Object.defineProperties(undefined, {}) : object +>Object.defineProperties : (o: T, properties: PropertyDescriptorMap & ThisType) => T +>Object : ObjectConstructor +>defineProperties : (o: T, properties: PropertyDescriptorMap & ThisType) => T +>undefined : undefined +>{} : {} + +Object.defineProperty(undefined, "foo", {}); +>Object.defineProperty(undefined, "foo", {}) : object +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>undefined : undefined +>"foo" : "foo" +>{} : {} + +Object.entries(undefined); +>Object.entries(undefined) : [string, unknown][] +>Object.entries : { (o: { [s: string]: T; } | ArrayLike): [string, T][]; (o: {}): [string, any][]; } +>Object : ObjectConstructor +>entries : { (o: { [s: string]: T; } | ArrayLike): [string, T][]; (o: {}): [string, any][]; } +>undefined : undefined + +Object.getOwnPropertyDescriptor(undefined, "foo"); +>Object.getOwnPropertyDescriptor(undefined, "foo") : PropertyDescriptor | undefined +>Object.getOwnPropertyDescriptor : (o: {}, p: PropertyKey) => PropertyDescriptor | undefined +>Object : ObjectConstructor +>getOwnPropertyDescriptor : (o: {}, p: PropertyKey) => PropertyDescriptor | undefined +>undefined : undefined +>"foo" : "foo" + +Object.getOwnPropertyDescriptors(undefined); +>Object.getOwnPropertyDescriptors(undefined) : {} & PropertyDescriptorMap +>Object.getOwnPropertyDescriptors : (o: T) => { [P in keyof T]: TypedPropertyDescriptor; } & PropertyDescriptorMap +>Object : ObjectConstructor +>getOwnPropertyDescriptors : (o: T) => { [P in keyof T]: TypedPropertyDescriptor; } & PropertyDescriptorMap +>undefined : undefined + +Object.getOwnPropertyNames(undefined); +>Object.getOwnPropertyNames(undefined) : string[] +>Object.getOwnPropertyNames : (o: {}) => string[] +>Object : ObjectConstructor +>getOwnPropertyNames : (o: {}) => string[] +>undefined : undefined + +Object.getOwnPropertySymbols(undefined); +>Object.getOwnPropertySymbols(undefined) : symbol[] +>Object.getOwnPropertySymbols : (o: {}) => symbol[] +>Object : ObjectConstructor +>getOwnPropertySymbols : (o: {}) => symbol[] +>undefined : undefined + +Object.getPrototypeOf(undefined); +>Object.getPrototypeOf(undefined) : any +>Object.getPrototypeOf : (o: {}) => any +>Object : ObjectConstructor +>getPrototypeOf : (o: {}) => any +>undefined : undefined + +Object.hasOwn(undefined, "foo"); +>Object.hasOwn(undefined, "foo") : boolean +>Object.hasOwn : (o: {}, v: PropertyKey) => boolean +>Object : ObjectConstructor +>hasOwn : (o: {}, v: PropertyKey) => boolean +>undefined : undefined +>"foo" : "foo" + +Object.keys(undefined); +>Object.keys(undefined) : string[] +>Object.keys : { (o: object): string[]; (o: {}): string[]; } +>Object : ObjectConstructor +>keys : { (o: object): string[]; (o: {}): string[]; } +>undefined : undefined + +Object.setPrototypeOf(undefined, {}); +>Object.setPrototypeOf(undefined, {}) : any +>Object.setPrototypeOf : (o: {}, proto: object | null) => any +>Object : ObjectConstructor +>setPrototypeOf : (o: {}, proto: object | null) => any +>undefined : undefined +>{} : {} + +Object.values(undefined); +>Object.values(undefined) : unknown[] +>Object.values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } +>Object : ObjectConstructor +>values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } +>undefined : undefined + +Object.create(0); +>Object.create(0) : any +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType): any; } +>Object : ObjectConstructor +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType): any; } +>0 : 0 + +Object.defineProperties(0, {}); +>Object.defineProperties(0, {}) : object +>Object.defineProperties : (o: T, properties: PropertyDescriptorMap & ThisType) => T +>Object : ObjectConstructor +>defineProperties : (o: T, properties: PropertyDescriptorMap & ThisType) => T +>0 : 0 +>{} : {} + +Object.defineProperty(0, "foo", {}); +>Object.defineProperty(0, "foo", {}) : object +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>0 : 0 +>"foo" : "foo" +>{} : {} + +// While the following should not: + +Object.assign(0); +>Object.assign(0) : 0 +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } +>Object : ObjectConstructor +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } +>0 : 0 + +Object.entries(0); +>Object.entries(0) : [string, any][] +>Object.entries : { (o: { [s: string]: T; } | ArrayLike): [string, T][]; (o: {}): [string, any][]; } +>Object : ObjectConstructor +>entries : { (o: { [s: string]: T; } | ArrayLike): [string, T][]; (o: {}): [string, any][]; } +>0 : 0 + +Object.getOwnPropertyDescriptor(0, "foo"); +>Object.getOwnPropertyDescriptor(0, "foo") : PropertyDescriptor | undefined +>Object.getOwnPropertyDescriptor : (o: {}, p: PropertyKey) => PropertyDescriptor | undefined +>Object : ObjectConstructor +>getOwnPropertyDescriptor : (o: {}, p: PropertyKey) => PropertyDescriptor | undefined +>0 : 0 +>"foo" : "foo" + +Object.getOwnPropertyDescriptors(0); +>Object.getOwnPropertyDescriptors(0) : number & PropertyDescriptorMap +>Object.getOwnPropertyDescriptors : (o: T) => { [P in keyof T]: TypedPropertyDescriptor; } & PropertyDescriptorMap +>Object : ObjectConstructor +>getOwnPropertyDescriptors : (o: T) => { [P in keyof T]: TypedPropertyDescriptor; } & PropertyDescriptorMap +>0 : 0 + +Object.getOwnPropertyNames(0); +>Object.getOwnPropertyNames(0) : string[] +>Object.getOwnPropertyNames : (o: {}) => string[] +>Object : ObjectConstructor +>getOwnPropertyNames : (o: {}) => string[] +>0 : 0 + +Object.getOwnPropertySymbols(0); +>Object.getOwnPropertySymbols(0) : symbol[] +>Object.getOwnPropertySymbols : (o: {}) => symbol[] +>Object : ObjectConstructor +>getOwnPropertySymbols : (o: {}) => symbol[] +>0 : 0 + +Object.getPrototypeOf(0); +>Object.getPrototypeOf(0) : any +>Object.getPrototypeOf : (o: {}) => any +>Object : ObjectConstructor +>getPrototypeOf : (o: {}) => any +>0 : 0 + +Object.hasOwn(0, "foo"); +>Object.hasOwn(0, "foo") : boolean +>Object.hasOwn : (o: {}, v: PropertyKey) => boolean +>Object : ObjectConstructor +>hasOwn : (o: {}, v: PropertyKey) => boolean +>0 : 0 +>"foo" : "foo" + +Object.keys(0); +>Object.keys(0) : string[] +>Object.keys : { (o: object): string[]; (o: {}): string[]; } +>Object : ObjectConstructor +>keys : { (o: object): string[]; (o: {}): string[]; } +>0 : 0 + +Object.setPrototypeOf(0, {}); +>Object.setPrototypeOf(0, {}) : any +>Object.setPrototypeOf : (o: {}, proto: object | null) => any +>Object : ObjectConstructor +>setPrototypeOf : (o: {}, proto: object | null) => any +>0 : 0 +>{} : {} + +Object.values(0); +>Object.values(0) : any[] +>Object.values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } +>Object : ObjectConstructor +>values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } +>0 : 0 + +Object.freeze(undefined); +>Object.freeze(undefined) : undefined +>Object.freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } +>Object : ObjectConstructor +>freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } +>undefined : undefined + +Object.isExtensible(undefined); +>Object.isExtensible(undefined) : false +>Object.isExtensible : { (o: object): boolean; (o: any): false; } +>Object : ObjectConstructor +>isExtensible : { (o: object): boolean; (o: any): false; } +>undefined : undefined + +Object.isFrozen(undefined); +>Object.isFrozen(undefined) : true +>Object.isFrozen : { (o: object): boolean; (o: any): true; } +>Object : ObjectConstructor +>isFrozen : { (o: object): boolean; (o: any): true; } +>undefined : undefined + +Object.isSealed(undefined); +>Object.isSealed(undefined) : true +>Object.isSealed : { (o: object): boolean; (o: any): true; } +>Object : ObjectConstructor +>isSealed : { (o: object): boolean; (o: any): true; } +>undefined : undefined + +Object.preventExtensions(undefined); +>Object.preventExtensions(undefined) : undefined +>Object.preventExtensions : (o: T) => T +>Object : ObjectConstructor +>preventExtensions : (o: T) => T +>undefined : undefined + +Object.seal(undefined); +>Object.seal(undefined) : undefined +>Object.seal : (o: T) => T +>Object : ObjectConstructor +>seal : (o: T) => T +>undefined : undefined + +Object.freeze(0); +>Object.freeze(0) : number +>Object.freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } +>Object : ObjectConstructor +>freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } +>0 : 0 + +Object.isExtensible(0); +>Object.isExtensible(0) : false +>Object.isExtensible : { (o: object): boolean; (o: any): false; } +>Object : ObjectConstructor +>isExtensible : { (o: object): boolean; (o: any): false; } +>0 : 0 + +Object.isFrozen(0); +>Object.isFrozen(0) : true +>Object.isFrozen : { (o: object): boolean; (o: any): true; } +>Object : ObjectConstructor +>isFrozen : { (o: object): boolean; (o: any): true; } +>0 : 0 + +Object.isSealed(0); +>Object.isSealed(0) : true +>Object.isSealed : { (o: object): boolean; (o: any): true; } +>Object : ObjectConstructor +>isSealed : { (o: object): boolean; (o: any): true; } +>0 : 0 + +Object.preventExtensions(0); +>Object.preventExtensions(0) : 0 +>Object.preventExtensions : (o: T) => T +>Object : ObjectConstructor +>preventExtensions : (o: T) => T +>0 : 0 + +Object.seal(0); +>Object.seal(0) : 0 +>Object.seal : (o: T) => T +>Object : ObjectConstructor +>seal : (o: T) => T +>0 : 0 + diff --git a/tests/baselines/reference/parserUsingConstructorAsIdentifier.types b/tests/baselines/reference/parserUsingConstructorAsIdentifier.types index 0034fa0e136e5..29122ff0c0f67 100644 --- a/tests/baselines/reference/parserUsingConstructorAsIdentifier.types +++ b/tests/baselines/reference/parserUsingConstructorAsIdentifier.types @@ -90,9 +90,9 @@ Object.defineProperty(constructor.prototype, "constructor", { value: constructor, writable: true, configurable: true, enumerable: true }); >Object.defineProperty(constructor.prototype, "constructor", { value: constructor, writable: true, configurable: true, enumerable: true }) : any ->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >Object : ObjectConstructor ->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >constructor.prototype : any >constructor : any >prototype : any diff --git a/tests/baselines/reference/unionAndIntersectionInference1.symbols b/tests/baselines/reference/unionAndIntersectionInference1.symbols index 815e70ddce106..c3591912e67e4 100644 --- a/tests/baselines/reference/unionAndIntersectionInference1.symbols +++ b/tests/baselines/reference/unionAndIntersectionInference1.symbols @@ -272,9 +272,9 @@ const assign = (a: T, b: U) => Object.assign(a, b); >T : Symbol(T, Decl(unionAndIntersectionInference1.ts, 94, 16)) >b : Symbol(b, Decl(unionAndIntersectionInference1.ts, 94, 27)) >U : Symbol(U, Decl(unionAndIntersectionInference1.ts, 94, 18)) ->Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >a : Symbol(a, Decl(unionAndIntersectionInference1.ts, 94, 22)) >b : Symbol(b, Decl(unionAndIntersectionInference1.ts, 94, 27)) diff --git a/tests/baselines/reference/unionAndIntersectionInference1.types b/tests/baselines/reference/unionAndIntersectionInference1.types index ec56cbbd1c4ac..3979a3a7bdb9f 100644 --- a/tests/baselines/reference/unionAndIntersectionInference1.types +++ b/tests/baselines/reference/unionAndIntersectionInference1.types @@ -241,22 +241,22 @@ const func = () => {}; >() => {} : () => void const assign = (a: T, b: U) => Object.assign(a, b); ->assign : (a: T, b: U) => T & U ->(a: T, b: U) => Object.assign(a, b) : (a: T, b: U) => T & U +>assign : (a: T, b: U) => T & Writable +>(a: T, b: U) => Object.assign(a, b) : (a: T, b: U) => T & Writable >a : T >b : U ->Object.assign(a, b) : T & U ->Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object.assign(a, b) : T & Writable +>Object.assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >Object : ObjectConstructor ->assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>assign : { (target: T): T; (target: T, source: U): T & Writable; (target: T, source1: U, source2: V): T & Writable & Writable; (target: T, source1: U, source2: V, source3: W): T & Writable & Writable & Writable; (target: {}, ...sources: any[]): any; } >a : T >b : U const res: (() => void) & { func: any } = assign(() => {}, { func }); >res : (() => void) & { func: any; } >func : any ->assign(() => {}, { func }) : (() => void) & { func: () => void; } ->assign : (a: T, b: U) => T & U +>assign(() => {}, { func }) : (() => void) & Writable<{ func: () => void; }> +>assign : (a: T, b: U) => T & Writable >() => {} : () => void >{ func } : { func: () => void; } >func : () => void diff --git a/tests/cases/compiler/objectMethodNullability.ts b/tests/cases/compiler/objectMethodNullability.ts new file mode 100644 index 0000000000000..4c3038be83c7e --- /dev/null +++ b/tests/cases/compiler/objectMethodNullability.ts @@ -0,0 +1,51 @@ +// @lib: esnext +// @strict: true + +// All of the following should produce an error: + +Object.assign(undefined); +Object.create(undefined); +Object.defineProperties(undefined, {}); +Object.defineProperty(undefined, "foo", {}); +Object.entries(undefined); +Object.getOwnPropertyDescriptor(undefined, "foo"); +Object.getOwnPropertyDescriptors(undefined); +Object.getOwnPropertyNames(undefined); +Object.getOwnPropertySymbols(undefined); +Object.getPrototypeOf(undefined); +Object.hasOwn(undefined, "foo"); +Object.keys(undefined); +Object.setPrototypeOf(undefined, {}); +Object.values(undefined); + +Object.create(0); +Object.defineProperties(0, {}); +Object.defineProperty(0, "foo", {}); + +// While the following should not: + +Object.assign(0); +Object.entries(0); +Object.getOwnPropertyDescriptor(0, "foo"); +Object.getOwnPropertyDescriptors(0); +Object.getOwnPropertyNames(0); +Object.getOwnPropertySymbols(0); +Object.getPrototypeOf(0); +Object.hasOwn(0, "foo"); +Object.keys(0); +Object.setPrototypeOf(0, {}); +Object.values(0); + +Object.freeze(undefined); +Object.isExtensible(undefined); +Object.isFrozen(undefined); +Object.isSealed(undefined); +Object.preventExtensions(undefined); +Object.seal(undefined); + +Object.freeze(0); +Object.isExtensible(0); +Object.isFrozen(0); +Object.isSealed(0); +Object.preventExtensions(0); +Object.seal(0);