Skip to content

Spread types may only be created from object types #14409

Closed
@OliverJAsh

Description

@OliverJAsh

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions