Skip to content

Use 'Omit' instead of 'Pick<Exclude<...>>' for object rest #30948

Closed
@DanielRosenwasser

Description

@DanielRosenwasser
function f<T extends { a, b }>(x: T) {
    let { a, b, ...rest } = x;
}

Today, we type rest as Pick<T, Exclude<keyof T, "a" | "b">>. We should try to type this as Omit<T, "a" | "b"> if Omit is defined.

Metadata

Metadata

Assignees

Labels

Good First IssueWell scoped, documented and has the green lightHelp WantedYou can do thisSuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions