TypeScript/tests/baselines/reference/symbolProperty22.types
Wesley Wigham 87d10eb055
Eliminate well known symbols as a concept in the checker and rely on unique symbols (#42543)
* Eliminate well-known symbols in the checker: 2021 edition

* Actually update the lib text to say unique symbol, too (this is unneeded with compat code in place, but this makes goto-def make more sense)

* Add test showing mismatched symbol constructor type interop

* Add more test cases for some other related issues this fixes

* Revert computed name change

* Style comments
2021-02-22 14:43:28 -08:00

31 lines
889 B
Plaintext

=== tests/cases/conformance/es6/Symbols/symbolProperty22.ts ===
interface I<T, U> {
[Symbol.unscopables](x: T): U;
>[Symbol.unscopables] : (x: T) => U
>Symbol.unscopables : unique symbol
>Symbol : SymbolConstructor
>unscopables : unique symbol
>x : T
}
declare function foo<T, U>(p1: T, p2: I<T, U>): U;
>foo : <T, U>(p1: T, p2: I<T, U>) => U
>p1 : T
>p2 : I<T, U>
foo("", { [Symbol.unscopables]: s => s.length });
>foo("", { [Symbol.unscopables]: s => s.length }) : number
>foo : <T, U>(p1: T, p2: I<T, U>) => U
>"" : ""
>{ [Symbol.unscopables]: s => s.length } : { [Symbol.unscopables]: (s: string) => number; }
>[Symbol.unscopables] : (s: string) => number
>Symbol.unscopables : unique symbol
>Symbol : SymbolConstructor
>unscopables : unique symbol
>s => s.length : (s: string) => number
>s : string
>s.length : number
>s : string
>length : number