TypeScript/tests/baselines/reference/mappedTypeErrors2.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

76 lines
1.2 KiB
Text

=== tests/cases/conformance/types/mapped/mappedTypeErrors2.ts ===
// Repros from #17238
type AB = {
>AB : AB
a: 'a'
>a : "a"
b: 'a'
>b : "a"
};
type T1<K extends keyof AB> = { [key in AB[K]]: true };
>T1 : T1<K>
>K : K
>AB : AB
>key : key
>AB : AB
>K : K
>true : true
type T2<K extends 'a'|'b'> = T1<K>[K]; // Error
>T2 : T1<K>[K]
>K : K
>T1 : T1<K>
>K : K
>K : K
type R = AB[keyof AB]; // "a"
>R : "a"
>AB : AB
>AB : AB
type T3 = { [key in R]: true };
>T3 : T3
>key : key
>R : "a"
>true : true
type T4<K extends 'a'|'b'> = T3[K] // Error
>T4 : T3[K]
>K : K
>T3 : T3
>K : K
type T5<S extends 'a'|'b'|'extra'> = {[key in AB[S]]: true}[S]; // Error
>T5 : { [key in AB[S]]: true; }[S]
>S : S
>key : key
>AB : AB
>S : S
>true : true
>S : S
type T6<S extends 'a'|'b', L extends 'a'|'b'> = {[key in AB[S]]: true}[L]; // Error
>T6 : { [key in AB[S]]: true; }[L]
>S : S
>L : L
>key : key
>AB : AB
>S : S
>true : true
>L : L
type T7<S extends 'a'|'b', L extends 'a'> = {[key in AB[S]]: true}[L];
>T7 : { [key in AB[S]]: true; }[L]
>S : S
>L : L
>key : key
>AB : AB
>S : S
>true : true
>L : L