TypeScript/tests/baselines/reference/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types
Matthew Pietz dcaefe732e
Accept generics for defineProperty (#42424)
* Accept generics for defineProperty

Both `Object.defineProperty()` and `Object.defineProperties()` return their
first argument. Use a generic so that typings can be passed through.

* Update baselines

* update missed baseline

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-11 07:57:42 -08:00

80 lines
2.2 KiB
Plaintext

=== tests/cases/compiler/index.js ===
const _item = require("./namespacer");
>_item : typeof _item
>require("./namespacer") : typeof _item
>require : any
>"./namespacer" : "./namespacer"
module.exports = 12;
>module.exports = 12 : number
>module.exports : number
>module : typeof module
>exports : number
>12 : 12
Object.defineProperty(module, "exports", { value: "oh no" });
>Object.defineProperty(module, "exports", { value: "oh no" }) : typeof module
>Object.defineProperty : <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T
>Object : ObjectConstructor
>defineProperty : <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T
>module : typeof module
>"exports" : "exports"
>{ value: "oh no" } : { value: string; }
>value : string
>"oh no" : "oh no"
=== tests/cases/compiler/namespacey.js ===
const A = {}
>A : typeof A
>{} : {}
A.bar = class Q {}
>A.bar = class Q {} : typeof Q
>A.bar : typeof Q
>A : typeof A
>bar : typeof Q
>class Q {} : typeof Q
>Q : typeof Q
module.exports = A;
>module.exports = A : typeof A
>module.exports : typeof A
>module : { exports: typeof A; }
>exports : typeof A
>A : typeof A
=== tests/cases/compiler/namespacer.js ===
const B = {}
>B : typeof B
>{} : {}
B.NS = require("./namespacey");
>B.NS = require("./namespacey") : typeof A
>B.NS : string | typeof A
>B : typeof B
>NS : string | typeof A
>require("./namespacey") : typeof A
>require : any
>"./namespacey" : "./namespacey"
Object.defineProperty(B, "NS", { value: "why though", writable: true });
>Object.defineProperty(B, "NS", { value: "why though", writable: true }) : typeof B
>Object.defineProperty : <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T
>Object : ObjectConstructor
>defineProperty : <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T
>B : typeof B
>"NS" : "NS"
>{ value: "why though", writable: true } : { value: string; writable: true; }
>value : string
>"why though" : "why though"
>writable : true
>true : true
module.exports = B;
>module.exports = B : typeof B
>module.exports : typeof B
>module : { exports: typeof B; }
>exports : typeof B
>B : typeof B