Skip to content
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

Impossible to spread <T extends object> #24630

Closed
alex-kinokon opened this issue Jun 3, 2018 · 1 comment
Closed

Impossible to spread <T extends object> #24630

alex-kinokon opened this issue Jun 3, 2018 · 1 comment

Comments

@alex-kinokon
Copy link

TypeScript Version: 2.9.1

Search Terms:
object type, generic, spread, error

Code

function test<T extends object>(a: T) {
    return { ...a };
}

Expected behavior:
No error.

Actual behavior:
Error: Spread types may only be created from object types.

Playground Link:
Here you go.

Related Issues:
None found so far.

@alex-kinokon
Copy link
Author

A dup of #13288? But that PR is started 1.5 years ago and there seems to have no progress.

@microsoft microsoft locked and limited conversation to collaborators Aug 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant