diff --git a/tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts b/tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts new file mode 100644 index 00000000000..8ceb578dc0a --- /dev/null +++ b/tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts @@ -0,0 +1,22 @@ +// @strict: true + +// Repro from #20196 + +type A = { + a: (x: number) => string +}; +type B = { + a: (x: boolean) => string +}; + +function call0(p: A | B) { + p.a("s"); // Error +} + +function callN(p: T) { + p.a("s"); // Error + + var a: T["a"] = p.a; + a(""); // Error + a("", "", "", ""); // Error +} \ No newline at end of file