Accept new baselines

This commit is contained in:
Daniel Rosenwasser
2018-12-10 13:12:56 -08:00
parent 975845a68f
commit dcc8bd47f5
4 changed files with 355 additions and 0 deletions
@@ -203,4 +203,47 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2
type C2<T, V, E> =
T extends object ? { [Q in keyof T]: C2<T[Q], V, E>; } : T;
// Repro from #28654
type MaybeTrue<T extends { b: boolean }> = true extends T["b"] ? "yes" : "no";
type T0 = MaybeTrue<{ b: never }> // "no"
type T1 = MaybeTrue<{ b: false }>; // "no"
type T2 = MaybeTrue<{ b: true }>; // "yes"
type T3 = MaybeTrue<{ b: boolean }>; // "yes"
// Repro from #28824
type Union = 'a' | 'b';
type Product<A extends Union, B> = { f1: A, f2: B};
type ProductUnion = Product<'a', 0> | Product<'b', 1>;
// {a: "b"; b: "a"}
type UnionComplement = {
[K in Union]: Exclude<Union, K>
};
type UCA = UnionComplement['a'];
type UCB = UnionComplement['b'];
// {a: "a"; b: "b"}
type UnionComplementComplement = {
[K in Union]: Exclude<Union, Exclude<Union, K>>
};
type UCCA = UnionComplementComplement['a'];
type UCCB = UnionComplementComplement['b'];
// {a: Product<'b', 1>; b: Product<'a', 0>}
type ProductComplement = {
[K in Union]: Exclude<ProductUnion, { f1: K }>
};
type PCA = ProductComplement['a'];
type PCB = ProductComplement['b'];
// {a: Product<'a', 0>; b: Product<'b', 1>}
type ProductComplementComplement = {
[K in Union]: Exclude<ProductUnion, Exclude<ProductUnion, { f1: K }>>
};
type PCCA = ProductComplementComplement['a'];
type PCCB = ProductComplementComplement['b'];
@@ -145,6 +145,49 @@ type B2<T, V> =
type C2<T, V, E> =
T extends object ? { [Q in keyof T]: C2<T[Q], V, E>; } : T;
// Repro from #28654
type MaybeTrue<T extends { b: boolean }> = true extends T["b"] ? "yes" : "no";
type T0 = MaybeTrue<{ b: never }> // "no"
type T1 = MaybeTrue<{ b: false }>; // "no"
type T2 = MaybeTrue<{ b: true }>; // "yes"
type T3 = MaybeTrue<{ b: boolean }>; // "yes"
// Repro from #28824
type Union = 'a' | 'b';
type Product<A extends Union, B> = { f1: A, f2: B};
type ProductUnion = Product<'a', 0> | Product<'b', 1>;
// {a: "b"; b: "a"}
type UnionComplement = {
[K in Union]: Exclude<Union, K>
};
type UCA = UnionComplement['a'];
type UCB = UnionComplement['b'];
// {a: "a"; b: "b"}
type UnionComplementComplement = {
[K in Union]: Exclude<Union, Exclude<Union, K>>
};
type UCCA = UnionComplementComplement['a'];
type UCCB = UnionComplementComplement['b'];
// {a: Product<'b', 1>; b: Product<'a', 0>}
type ProductComplement = {
[K in Union]: Exclude<ProductUnion, { f1: K }>
};
type PCA = ProductComplement['a'];
type PCB = ProductComplement['b'];
// {a: Product<'a', 0>; b: Product<'b', 1>}
type ProductComplementComplement = {
[K in Union]: Exclude<ProductUnion, Exclude<ProductUnion, { f1: K }>>
};
type PCCA = ProductComplementComplement['a'];
type PCCB = ProductComplementComplement['b'];
//// [conditionalTypes2.js]
@@ -304,3 +347,48 @@ declare type B2<T, V> = T extends object ? T extends any[] ? T : {
declare type C2<T, V, E> = T extends object ? {
[Q in keyof T]: C2<T[Q], V, E>;
} : T;
declare type MaybeTrue<T extends {
b: boolean;
}> = true extends T["b"] ? "yes" : "no";
declare type T0 = MaybeTrue<{
b: never;
}>;
declare type T1 = MaybeTrue<{
b: false;
}>;
declare type T2 = MaybeTrue<{
b: true;
}>;
declare type T3 = MaybeTrue<{
b: boolean;
}>;
declare type Union = 'a' | 'b';
declare type Product<A extends Union, B> = {
f1: A;
f2: B;
};
declare type ProductUnion = Product<'a', 0> | Product<'b', 1>;
declare type UnionComplement = {
[K in Union]: Exclude<Union, K>;
};
declare type UCA = UnionComplement['a'];
declare type UCB = UnionComplement['b'];
declare type UnionComplementComplement = {
[K in Union]: Exclude<Union, Exclude<Union, K>>;
};
declare type UCCA = UnionComplementComplement['a'];
declare type UCCB = UnionComplementComplement['b'];
declare type ProductComplement = {
[K in Union]: Exclude<ProductUnion, {
f1: K;
}>;
};
declare type PCA = ProductComplement['a'];
declare type PCB = ProductComplement['b'];
declare type ProductComplementComplement = {
[K in Union]: Exclude<ProductUnion, Exclude<ProductUnion, {
f1: K;
}>>;
};
declare type PCCA = ProductComplementComplement['a'];
declare type PCCB = ProductComplementComplement['b'];
@@ -551,3 +551,137 @@ type C2<T, V, E> =
>E : Symbol(E, Decl(conditionalTypes2.ts, 144, 13))
>T : Symbol(T, Decl(conditionalTypes2.ts, 144, 8))
// Repro from #28654
type MaybeTrue<T extends { b: boolean }> = true extends T["b"] ? "yes" : "no";
>MaybeTrue : Symbol(MaybeTrue, Decl(conditionalTypes2.ts, 145, 63))
>T : Symbol(T, Decl(conditionalTypes2.ts, 149, 15))
>b : Symbol(b, Decl(conditionalTypes2.ts, 149, 26))
>T : Symbol(T, Decl(conditionalTypes2.ts, 149, 15))
type T0 = MaybeTrue<{ b: never }> // "no"
>T0 : Symbol(T0, Decl(conditionalTypes2.ts, 149, 78))
>MaybeTrue : Symbol(MaybeTrue, Decl(conditionalTypes2.ts, 145, 63))
>b : Symbol(b, Decl(conditionalTypes2.ts, 151, 21))
type T1 = MaybeTrue<{ b: false }>; // "no"
>T1 : Symbol(T1, Decl(conditionalTypes2.ts, 151, 33))
>MaybeTrue : Symbol(MaybeTrue, Decl(conditionalTypes2.ts, 145, 63))
>b : Symbol(b, Decl(conditionalTypes2.ts, 152, 21))
type T2 = MaybeTrue<{ b: true }>; // "yes"
>T2 : Symbol(T2, Decl(conditionalTypes2.ts, 152, 34))
>MaybeTrue : Symbol(MaybeTrue, Decl(conditionalTypes2.ts, 145, 63))
>b : Symbol(b, Decl(conditionalTypes2.ts, 153, 21))
type T3 = MaybeTrue<{ b: boolean }>; // "yes"
>T3 : Symbol(T3, Decl(conditionalTypes2.ts, 153, 33))
>MaybeTrue : Symbol(MaybeTrue, Decl(conditionalTypes2.ts, 145, 63))
>b : Symbol(b, Decl(conditionalTypes2.ts, 154, 21))
// Repro from #28824
type Union = 'a' | 'b';
>Union : Symbol(Union, Decl(conditionalTypes2.ts, 154, 36))
type Product<A extends Union, B> = { f1: A, f2: B};
>Product : Symbol(Product, Decl(conditionalTypes2.ts, 158, 23))
>A : Symbol(A, Decl(conditionalTypes2.ts, 159, 13))
>Union : Symbol(Union, Decl(conditionalTypes2.ts, 154, 36))
>B : Symbol(B, Decl(conditionalTypes2.ts, 159, 29))
>f1 : Symbol(f1, Decl(conditionalTypes2.ts, 159, 36))
>A : Symbol(A, Decl(conditionalTypes2.ts, 159, 13))
>f2 : Symbol(f2, Decl(conditionalTypes2.ts, 159, 43))
>B : Symbol(B, Decl(conditionalTypes2.ts, 159, 29))
type ProductUnion = Product<'a', 0> | Product<'b', 1>;
>ProductUnion : Symbol(ProductUnion, Decl(conditionalTypes2.ts, 159, 51))
>Product : Symbol(Product, Decl(conditionalTypes2.ts, 158, 23))
>Product : Symbol(Product, Decl(conditionalTypes2.ts, 158, 23))
// {a: "b"; b: "a"}
type UnionComplement = {
>UnionComplement : Symbol(UnionComplement, Decl(conditionalTypes2.ts, 160, 54))
[K in Union]: Exclude<Union, K>
>K : Symbol(K, Decl(conditionalTypes2.ts, 164, 3))
>Union : Symbol(Union, Decl(conditionalTypes2.ts, 154, 36))
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
>Union : Symbol(Union, Decl(conditionalTypes2.ts, 154, 36))
>K : Symbol(K, Decl(conditionalTypes2.ts, 164, 3))
};
type UCA = UnionComplement['a'];
>UCA : Symbol(UCA, Decl(conditionalTypes2.ts, 165, 2))
>UnionComplement : Symbol(UnionComplement, Decl(conditionalTypes2.ts, 160, 54))
type UCB = UnionComplement['b'];
>UCB : Symbol(UCB, Decl(conditionalTypes2.ts, 166, 32))
>UnionComplement : Symbol(UnionComplement, Decl(conditionalTypes2.ts, 160, 54))
// {a: "a"; b: "b"}
type UnionComplementComplement = {
>UnionComplementComplement : Symbol(UnionComplementComplement, Decl(conditionalTypes2.ts, 167, 32))
[K in Union]: Exclude<Union, Exclude<Union, K>>
>K : Symbol(K, Decl(conditionalTypes2.ts, 171, 3))
>Union : Symbol(Union, Decl(conditionalTypes2.ts, 154, 36))
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
>Union : Symbol(Union, Decl(conditionalTypes2.ts, 154, 36))
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
>Union : Symbol(Union, Decl(conditionalTypes2.ts, 154, 36))
>K : Symbol(K, Decl(conditionalTypes2.ts, 171, 3))
};
type UCCA = UnionComplementComplement['a'];
>UCCA : Symbol(UCCA, Decl(conditionalTypes2.ts, 172, 2))
>UnionComplementComplement : Symbol(UnionComplementComplement, Decl(conditionalTypes2.ts, 167, 32))
type UCCB = UnionComplementComplement['b'];
>UCCB : Symbol(UCCB, Decl(conditionalTypes2.ts, 173, 43))
>UnionComplementComplement : Symbol(UnionComplementComplement, Decl(conditionalTypes2.ts, 167, 32))
// {a: Product<'b', 1>; b: Product<'a', 0>}
type ProductComplement = {
>ProductComplement : Symbol(ProductComplement, Decl(conditionalTypes2.ts, 174, 43))
[K in Union]: Exclude<ProductUnion, { f1: K }>
>K : Symbol(K, Decl(conditionalTypes2.ts, 178, 3))
>Union : Symbol(Union, Decl(conditionalTypes2.ts, 154, 36))
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
>ProductUnion : Symbol(ProductUnion, Decl(conditionalTypes2.ts, 159, 51))
>f1 : Symbol(f1, Decl(conditionalTypes2.ts, 178, 39))
>K : Symbol(K, Decl(conditionalTypes2.ts, 178, 3))
};
type PCA = ProductComplement['a'];
>PCA : Symbol(PCA, Decl(conditionalTypes2.ts, 179, 2))
>ProductComplement : Symbol(ProductComplement, Decl(conditionalTypes2.ts, 174, 43))
type PCB = ProductComplement['b'];
>PCB : Symbol(PCB, Decl(conditionalTypes2.ts, 180, 34))
>ProductComplement : Symbol(ProductComplement, Decl(conditionalTypes2.ts, 174, 43))
// {a: Product<'a', 0>; b: Product<'b', 1>}
type ProductComplementComplement = {
>ProductComplementComplement : Symbol(ProductComplementComplement, Decl(conditionalTypes2.ts, 181, 34))
[K in Union]: Exclude<ProductUnion, Exclude<ProductUnion, { f1: K }>>
>K : Symbol(K, Decl(conditionalTypes2.ts, 185, 3))
>Union : Symbol(Union, Decl(conditionalTypes2.ts, 154, 36))
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
>ProductUnion : Symbol(ProductUnion, Decl(conditionalTypes2.ts, 159, 51))
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
>ProductUnion : Symbol(ProductUnion, Decl(conditionalTypes2.ts, 159, 51))
>f1 : Symbol(f1, Decl(conditionalTypes2.ts, 185, 61))
>K : Symbol(K, Decl(conditionalTypes2.ts, 185, 3))
};
type PCCA = ProductComplementComplement['a'];
>PCCA : Symbol(PCCA, Decl(conditionalTypes2.ts, 186, 2))
>ProductComplementComplement : Symbol(ProductComplementComplement, Decl(conditionalTypes2.ts, 181, 34))
type PCCB = ProductComplementComplement['b'];
>PCCB : Symbol(PCCB, Decl(conditionalTypes2.ts, 187, 45))
>ProductComplementComplement : Symbol(ProductComplementComplement, Decl(conditionalTypes2.ts, 181, 34))
@@ -341,3 +341,93 @@ type C2<T, V, E> =
T extends object ? { [Q in keyof T]: C2<T[Q], V, E>; } : T;
// Repro from #28654
type MaybeTrue<T extends { b: boolean }> = true extends T["b"] ? "yes" : "no";
>MaybeTrue : MaybeTrue<T>
>b : boolean
>true : true
type T0 = MaybeTrue<{ b: never }> // "no"
>T0 : "no"
>b : never
type T1 = MaybeTrue<{ b: false }>; // "no"
>T1 : "no"
>b : false
>false : false
type T2 = MaybeTrue<{ b: true }>; // "yes"
>T2 : "yes"
>b : true
>true : true
type T3 = MaybeTrue<{ b: boolean }>; // "yes"
>T3 : "yes"
>b : boolean
// Repro from #28824
type Union = 'a' | 'b';
>Union : Union
type Product<A extends Union, B> = { f1: A, f2: B};
>Product : Product<A, B>
>f1 : A
>f2 : B
type ProductUnion = Product<'a', 0> | Product<'b', 1>;
>ProductUnion : ProductUnion
// {a: "b"; b: "a"}
type UnionComplement = {
>UnionComplement : UnionComplement
[K in Union]: Exclude<Union, K>
};
type UCA = UnionComplement['a'];
>UCA : "b"
type UCB = UnionComplement['b'];
>UCB : "a"
// {a: "a"; b: "b"}
type UnionComplementComplement = {
>UnionComplementComplement : UnionComplementComplement
[K in Union]: Exclude<Union, Exclude<Union, K>>
};
type UCCA = UnionComplementComplement['a'];
>UCCA : "a"
type UCCB = UnionComplementComplement['b'];
>UCCB : "b"
// {a: Product<'b', 1>; b: Product<'a', 0>}
type ProductComplement = {
>ProductComplement : ProductComplement
[K in Union]: Exclude<ProductUnion, { f1: K }>
>f1 : K
};
type PCA = ProductComplement['a'];
>PCA : Product<"b", 1>
type PCB = ProductComplement['b'];
>PCB : Product<"a", 0>
// {a: Product<'a', 0>; b: Product<'b', 1>}
type ProductComplementComplement = {
>ProductComplementComplement : ProductComplementComplement
[K in Union]: Exclude<ProductUnion, Exclude<ProductUnion, { f1: K }>>
>f1 : K
};
type PCCA = ProductComplementComplement['a'];
>PCCA : Product<"a", 0>
type PCCB = ProductComplementComplement['b'];
>PCCB : Product<"b", 1>