diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt b/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt index 9bdfc6f30f9..97ed1cf4895 100644 --- a/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt +++ b/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt @@ -80,4 +80,9 @@ tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(12 type UnexpectedError = T type NoErrorHere = T + + // Repro from #30331 + + type a = T extends Array ? U : never; + type b = { [K in a & keyof T ]: 42 }; \ No newline at end of file diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.js b/tests/baselines/reference/intersectionWithUnionConstraint.js index fc3e50309c6..00330d23f6d 100644 --- a/tests/baselines/reference/intersectionWithUnionConstraint.js +++ b/tests/baselines/reference/intersectionWithUnionConstraint.js @@ -33,6 +33,11 @@ type Example = { [K in keyof T]: K extends keyof U ? UnexpectedError : type UnexpectedError = T type NoErrorHere = T + +// Repro from #30331 + +type a = T extends Array ? U : never; +type b = { [K in a & keyof T ]: 42 }; //// [intersectionWithUnionConstraint.js] diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.symbols b/tests/baselines/reference/intersectionWithUnionConstraint.symbols index f481a5c5185..1ef1f8435d9 100644 --- a/tests/baselines/reference/intersectionWithUnionConstraint.symbols +++ b/tests/baselines/reference/intersectionWithUnionConstraint.symbols @@ -112,3 +112,21 @@ type NoErrorHere = T >PropertyKey : Symbol(PropertyKey, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 33, 17)) +// Repro from #30331 + +type a = T extends Array ? U : never; +>a : Symbol(a, Decl(intersectionWithUnionConstraint.ts, 33, 43)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 37, 7)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 37, 7)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 37, 33)) +>U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 37, 33)) + +type b = { [K in a & keyof T ]: 42 }; +>b : Symbol(b, Decl(intersectionWithUnionConstraint.ts, 37, 49)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 38, 7)) +>K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 38, 15)) +>a : Symbol(a, Decl(intersectionWithUnionConstraint.ts, 33, 43)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 38, 7)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 38, 7)) + diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.types b/tests/baselines/reference/intersectionWithUnionConstraint.types index 126154a4968..0f9e9974bed 100644 --- a/tests/baselines/reference/intersectionWithUnionConstraint.types +++ b/tests/baselines/reference/intersectionWithUnionConstraint.types @@ -84,3 +84,11 @@ type UnexpectedError = T type NoErrorHere = T >NoErrorHere : T +// Repro from #30331 + +type a = T extends Array ? U : never; +>a : a + +type b = { [K in a & keyof T ]: 42 }; +>b : b +