TypeScript/tests/baselines/reference/objectFreeze.types
Wesley Wigham 5353475fce Always collect type and symbol baselines (#18621)
* Always generate type & symbol baselines

* Accept changed shadowed baselines

* Accept brand new type and symbol baselines

* Allow `getTypeAtLocation` to return undefined in the type writer

* Accept baselines which had missing type information

* Bind container for dynamically names enum members so they may be printed

* Accept type/symbol baselines for enums with computed members

* First pass at reducing typeWriter memory overhead

* Use generators to allow for type and symbol baselines with no cache

* Accept new baselines for tests whose output was fixed by better newline splitting

* Hard cap on number of declarations printed, cache declaration print text

* handle differing newlines better still to handle RWC newlines

* Lower abridging count, accept abridged baselines

* Limit max RWC error output size, limit RWC type and symbol baseline input size

* Move skip logic into type and symbol baseliner to streamline error handling

* Accept removal of empty baselines

* Canonicalize path earlier to handle odd paths in input files

* Do canonicalization earlier still, also ensure parallel perf profiles for different targets do not trample one another

* No need to pathify again
2017-09-22 15:52:04 -07:00

86 lines
2.7 KiB
Plaintext

=== tests/cases/compiler/objectFreeze.ts ===
const f = Object.freeze(function foo(a: number, b: string) { return false; });
>f : (a: number, b: string) => false
>Object.freeze(function foo(a: number, b: string) { return false; }) : (a: number, b: string) => false
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
>Object : ObjectConstructor
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
>function foo(a: number, b: string) { return false; } : (a: number, b: string) => false
>foo : (a: number, b: string) => false
>a : number
>b : string
>false : false
f(1, "") === false;
>f(1, "") === false : boolean
>f(1, "") : false
>f : (a: number, b: string) => false
>1 : 1
>"" : ""
>false : false
class C { constructor(a: number) { } }
>C : C
>a : number
const c = Object.freeze(C);
>c : typeof C
>Object.freeze(C) : typeof C
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
>Object : ObjectConstructor
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
>C : typeof C
new c(1);
>new c(1) : C
>c : typeof C
>1 : 1
const a = Object.freeze([1, 2, 3]);
>a : ReadonlyArray<number>
>Object.freeze([1, 2, 3]) : ReadonlyArray<number>
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
>Object : ObjectConstructor
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
>[1, 2, 3] : number[]
>1 : 1
>2 : 2
>3 : 3
a[0] = a[2].toString();
>a[0] = a[2].toString() : string
>a[0] : number
>a : ReadonlyArray<number>
>0 : 0
>a[2].toString() : string
>a[2].toString : (radix?: number) => string
>a[2] : number
>a : ReadonlyArray<number>
>2 : 2
>toString : (radix?: number) => string
const o = Object.freeze({ a: 1, b: "string" });
>o : Readonly<{ a: number; b: string; }>
>Object.freeze({ a: 1, b: "string" }) : Readonly<{ a: number; b: string; }>
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
>Object : ObjectConstructor
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
>{ a: 1, b: "string" } : { a: number; b: string; }
>a : number
>1 : 1
>b : string
>"string" : "string"
o.b = o.a.toString();
>o.b = o.a.toString() : string
>o.b : any
>o : Readonly<{ a: number; b: string; }>
>b : any
>o.a.toString() : string
>o.a.toString : (radix?: number) => string
>o.a : number
>o : Readonly<{ a: number; b: string; }>
>a : number
>toString : (radix?: number) => string