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

Spread types may only be created from object types #14409

Closed
OliverJAsh opened this issue Mar 2, 2017 · 3 comments
Closed

Spread types may only be created from object types #14409

OliverJAsh opened this issue Mar 2, 2017 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@OliverJAsh
Copy link
Contributor

Version 2.2.1

let p = {} as any as object;
const z = { ...p } // works fine
const fn = <T extends object>(t: T) => {
	return { ...t } // Error: Spread types may only be created from object types.
}

Should this be erroring?

@mhegazy
Copy link
Contributor

mhegazy commented Mar 2, 2017

Tracked by #10727, fixed by #13288

@mhegazy mhegazy added the Duplicate An existing issue was already created label Mar 2, 2017
@mhegazy mhegazy closed this as completed Apr 21, 2017
@zheeeng
Copy link

zheeeng commented Sep 11, 2017

@mhegazy I still get this error on TS online playground and VS Code with TS 2.4.2

@kitsonk
Copy link
Contributor

kitsonk commented Sep 11, 2017

@zheeeng #13288 is not yet merged and #10727 is still open. Commenting on issues closed as duplicate helps no one.

@OliverJAsh OliverJAsh changed the title Spead types may only be created from object types Spread types may only be created from object types Apr 27, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants