Skip to content

Spread operator should work with generic types #13557

Closed
@falsandtru

Description

@falsandtru

TypeScript Version: master

Code

function f<a extends Object>() {
	return {...<a>{}};
}
function g<a extends object>() {
	return {...<a>{}};
}

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.

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