6aeb8c12cc
* Create separate types for equivalent aliased unions * Accept new baselines * Preserve original types for union types * Accept new baselines * Preserve intersection origin for union types * Accept new baselines * Accept new baselines * Preserve aliases during relationship checks * Accept new baselines * Preserve aliases for intersection and indexed access types * Accept new baselines * Compute intersection-of-unions cross product without recursion * Accept new baselines * Use denormalized type objects for origin / support 'keyof' origins * Accept new baselines * Fix fourslash test * Recursively extract named union types * Accept new baselines * Map on union origin in mapType to better preserve aliases and origins * Remove redundant call * Accept new baselines * Revert back to declared type when branches produce equivalent union * Accept new baselines * Don't include denormal origin types in regular type statistics * Fix issue with unions not being marked primitive-only * Allow new alias to be associated with type alias instantiation * Accept new baselines * Revert "Accept new baselines" This reverts commit4507270cc1
. * Revert "Allow new alias to be associated with type alias instantiation" This reverts commit2c2d06dfe1
.
130 lines
1.8 KiB
Plaintext
130 lines
1.8 KiB
Plaintext
=== tests/cases/compiler/indexerConstraints2.ts ===
|
|
class A { a: number; }
|
|
>A : A
|
|
>a : number
|
|
|
|
class B extends A { b: number; }
|
|
>B : B
|
|
>A : A
|
|
>b : number
|
|
|
|
// Inheritance
|
|
class F {
|
|
>F : F
|
|
|
|
[s: string]: B
|
|
>s : string
|
|
}
|
|
class G extends F {
|
|
>G : G
|
|
>F : F
|
|
|
|
[n: number]: A
|
|
>n : number
|
|
}
|
|
|
|
// Other way
|
|
class H {
|
|
>H : H
|
|
|
|
[n: number]: A
|
|
>n : number
|
|
}
|
|
class I extends H {
|
|
>I : I
|
|
>H : H
|
|
|
|
[s: string]: B
|
|
>s : string
|
|
}
|
|
|
|
// With hidden indexer
|
|
class J {
|
|
>J : J
|
|
|
|
[n: number]: {}
|
|
>n : number
|
|
}
|
|
|
|
class K extends J {
|
|
>K : K
|
|
>J : J
|
|
|
|
[n: number]: A;
|
|
>n : number
|
|
|
|
[s: string]: B;
|
|
>s : string
|
|
}
|
|
|
|
|
|
type AliasedNumber = number;
|
|
>AliasedNumber : number
|
|
|
|
interface L {
|
|
[n: AliasedNumber]: A;
|
|
>n : number
|
|
}
|
|
|
|
type AliasedString = string;
|
|
>AliasedString : string
|
|
|
|
interface M {
|
|
[s: AliasedString]: A;
|
|
>s : string
|
|
}
|
|
|
|
type AliasedBoolean = boolean;
|
|
>AliasedBoolean : boolean
|
|
|
|
interface N {
|
|
[b: AliasedBoolean]: A;
|
|
>b : boolean
|
|
}
|
|
|
|
type IndexableUnion = "foo" | "bar";
|
|
>IndexableUnion : IndexableUnion
|
|
|
|
interface O {
|
|
[u: IndexableUnion]: A;
|
|
>u : IndexableUnion
|
|
}
|
|
|
|
type NonIndexableUnion = boolean | {};
|
|
>NonIndexableUnion : NonIndexableUnion
|
|
|
|
interface P {
|
|
[u: NonIndexableUnion]: A;
|
|
>u : NonIndexableUnion
|
|
}
|
|
|
|
type NonIndexableUnion2 = string | number;
|
|
>NonIndexableUnion2 : NonIndexableUnion2
|
|
|
|
interface Q {
|
|
[u: NonIndexableUnion2]: A;
|
|
>u : NonIndexableUnion2
|
|
}
|
|
|
|
type NonIndexableUnion3 = "foo" | 42;
|
|
>NonIndexableUnion3 : NonIndexableUnion3
|
|
|
|
interface R {
|
|
[u: NonIndexableUnion3]: A;
|
|
>u : NonIndexableUnion3
|
|
}
|
|
|
|
interface S {
|
|
[u: "foo" | "bar"]: A;
|
|
>u : "foo" | "bar"
|
|
}
|
|
|
|
type Key = string;
|
|
>Key : string
|
|
|
|
interface T {
|
|
[key: Key]
|
|
>key : string
|
|
}
|
|
|