Typescript: Use 'Omit' instead of 'Pick<Exclude<...>>' for object rest

Created on 16 Apr 2019  路  3Comments  路  Source: microsoft/TypeScript

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.

Suggestion good first issue help wanted

Most helpful comment

Hi @sandersn,
Can I take this? I like to contribute.
Thank you

All 3 comments

Hi @sandersn,
Can I take this? I like to contribute.
Thank you

Sure, go ahead! Start by looking at let deferredGlobalPickSymbol in checker.ts, and see where and how it's used.

@sandersn ,
Thank you so much. I鈥檒l start to work on this from today itself.
Thank you so much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MartynasZilinskas picture MartynasZilinskas  路  3Comments

Roam-Cooper picture Roam-Cooper  路  3Comments

uber5001 picture uber5001  路  3Comments

DanielRosenwasser picture DanielRosenwasser  路  3Comments

blendsdk picture blendsdk  路  3Comments