Skip to content

Spread syntax with extends object type parameters #20510

Closed
@ethanresnick

Description

@ethanresnick

TypeScript Version: 2.6.1

Code

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

Expected behavior:
No error

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

Metadata

Metadata

Assignees

Labels

Working as IntendedThe behavior described is the intended behavior; this is not a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions