diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts new file mode 100644 index 00000000000..a5b0c2e7638 --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts @@ -0,0 +1,14 @@ +// @strict: true + +// Repros from #23800 + +type A = { [P in keyof T]: T[P] extends V ? 1 : 0; }; +type B = { [P in keyof T]: T[P] extends V | object ? 1 : 0; }; + +type a = A<{ a: 0 | 1 }, 0>; // { a: 0; } +type b = B<{ a: 0 | 1 }, 0>; // { a: 0; } + +function foo(x: T) { + let a: object = x; // Error + let b: U | object = x; // Error +}