Closed
Description
openedon Mar 16, 2019
TypeScript Version: 3.4.0-rc
Search Terms: Type parameters, generics, inference, regression
Code
const foo = <T>() => {};
const assign = <T, U>(a: T, b: U) => Object.assign(a, b);
const result: (() => void) & { foo: any } = assign(() => {}, { foo });
Expected behavior:
No error
Actual behavior:
Argument of type '{ foo: <T>() => void; }' is not assignable to parameter of type '(() => void) & { foo: any; }'.
Type '{ foo: <T>() => void; }' is not assignable to type '() => void'.
Type '{ foo: <T>() => void; }' provides no match for the signature '(): void'.
Related Issues:
Removing <T>
from foo
makes this code valid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment