-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spread operator should work with generic types #13557
Comments
Another example, it's quite hard for TypeScript to prove a type constraint is spreadable given structural typing class NonPrimitive {
private cannotBePrimitiveBrand
}
function t<T extends NonPrimitive>(a: T, b: NonPrimitive) {
var c = { ...a }
var d = { ...b }
} |
Another example: interface Foo {
foo: string;
}
const addBar = <F extends Foo>(input: F) => ({
... input,
bar: 5
}); Build |
@mhegazy This is still happening in the current build. |
yes. #13288 is not merged yet. we do not have an ETA at the moment. |
Aha, thanks. |
When it will be fixed finally? The problem persists and it's breaking code all over the place! |
Any plans fixing this? |
Is there a milestone or version that we can expect this to be fixed in? |
Count me in ! |
Any news on when/whether #13288 will be merged? This bug has been open for over a year now. |
@mhegazy |
Please read #13288 (comment) |
TypeScript Version: master
Code
Expected behavior:
ok
Actual behavior:
index.ts(2,10): error TS2698: Spread types may only be created from object types.
index.ts(5,10): error TS2698: Spread types may only be created from object types.
The text was updated successfully, but these errors were encountered: