diff --git a/tests/cases/compiler/inferenceAndSelfReferentialConstraint.ts b/tests/cases/compiler/inferenceAndSelfReferentialConstraint.ts new file mode 100644 index 00000000000..2d991a652c1 --- /dev/null +++ b/tests/cases/compiler/inferenceAndSelfReferentialConstraint.ts @@ -0,0 +1,29 @@ +// @strict + +// Repro from #29520 + +type Test = { + [P in K | "foo"]: P extends "foo" ? true : () => any +} + +function test>(arg: T) { + return arg; +} + +const res1 = test({ + foo: true, + bar() { + } +}); + +const res2 = test({ + foo: true, + bar: function () { + } +}); + +const res3 = test({ + foo: true, + bar: () => { + } +});