TypeScript Version: 3.5.3 - 3.7.0-dev.20191009
Search Terms: return type enforcement generic callable signature
Code
interfaceFoo{value: number}typeSomeCallType<T>=()=>T;constexample: SomeCallType<Foo>=()=>({value: 1,bar: 2})Expected behavior:
The above sample should not compile and instead emit ts(2322) because bar is not a valid property for Foo
Actual behavior:
The code will in fact compile and emit as if nothing were the matter.
Playground Link:here
Related Issues:
These may be related, given that they involve other cases where return types don't appear to be correctly enforced on callable signatures:
TypeScript Version: 3.5.3 - 3.7.0-dev.20191009
Search Terms: return type enforcement generic callable signature
Code
Expected behavior:
The above sample should not compile and instead emit
ts(2322)becausebaris not a valid property forFooActual behavior:
The code will in fact compile and emit as if nothing were the matter.
Playground Link:here
Related Issues:
These may be related, given that they involve other cases where return types don't appear to be correctly enforced on callable signatures:
Fhas one implicitly typed param #33042 deals with parameter inferences leading to incorrect return type inferences, but that doesn't apply here