Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DanielRosenwasser opened this issue Apr 16, 2019 · 3 comments · Fixed by #31134
Closed

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

DanielRosenwasser opened this issue Apr 16, 2019 · 3 comments · Fixed by #31134
Assignees
Labels
Good First Issue Well scoped, documented and has the green light Help Wanted You can do this Suggestion An idea for TypeScript

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Apr 16, 2019

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.

@DanielRosenwasser DanielRosenwasser added Suggestion An idea for TypeScript In Discussion Not yet reached consensus labels Apr 16, 2019
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 3.5.0 milestone Apr 16, 2019
@DanielRosenwasser DanielRosenwasser added Good First Issue Well scoped, documented and has the green light Help Wanted You can do this and removed In Discussion Not yet reached consensus labels Apr 16, 2019
@rpgeeganage
Copy link
Contributor

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

@sandersn
Copy link
Member

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

@rpgeeganage
Copy link
Contributor

@sandersn ,
Thank you so much. I’ll start to work on this from today itself.
Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Well scoped, documented and has the green light Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants