From 09bc7505a742b3ffd8bbf01ec50af2bdd8bef551 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 25 Aug 2018 16:09:18 -0700 Subject: [PATCH] Add regression test --- .../badInferenceLowerPriorityThanGoodInference.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/cases/compiler/badInferenceLowerPriorityThanGoodInference.ts b/tests/cases/compiler/badInferenceLowerPriorityThanGoodInference.ts index 59dfb3ff447..8092e909df6 100644 --- a/tests/cases/compiler/badInferenceLowerPriorityThanGoodInference.ts +++ b/tests/cases/compiler/badInferenceLowerPriorityThanGoodInference.ts @@ -1,3 +1,5 @@ +// Repro from #13118 + interface Foo { a: A; b: (x: A) => void; @@ -10,4 +12,11 @@ const result = canYouInferThis(() => ({ b: x => { } })) -result.BLAH; \ No newline at end of file +result.BLAH; + +// Repro from #26629 + +function goofus (f: (...args: ARGS) => any ) {} + +goofus((a: string) => ({ dog() { return a; } })); +goofus((a: string) => ({ dog: function() { return a; } }));