Skip to content

[Feature request] Omit mapped type #13980

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
abenhamdine opened this issue Feb 9, 2017 · 4 comments
Closed

[Feature request] Omit mapped type #13980

abenhamdine opened this issue Feb 9, 2017 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@abenhamdine
Copy link

First, thx a lot for the fantastic stuff 😄

Since ts 2.1, we have mapped types that are very usefull.
Pick is now included in the library, and allow to pick only some properties of a type T.
While Pick is usefull, it would be great to construct a type base on another type by omitting some properties, ie the opposite of Pick

Notably, it would allow to override some interfaces, eg :

interface Foo {
    name : string,
    age: number,
    id : string
}

// now we want the id as a number in a particular piece of code, along with the other properties
interface DifferentFoo extends Omit<Foo, "id"> {
   id: number
}
@aluanhaddad
Copy link
Contributor

Great idea but also likely a duplicate of #12424

@mhegazy mhegazy added the Duplicate An existing issue was already created label Feb 9, 2017
@abenhamdine
Copy link
Author

Hmm.. I didn't read very carefully #12424 (it's very dense...), but is this exactly the same request ?

#12424 seems to ask for a mapping to selected kinds of types, while I ask for a conditionnal mapping based on property names.

@abenhamdine
Copy link
Author

I rather think this is the same as #12215 (omit word is even already mentionned)

@abenhamdine
Copy link
Author

closed in favor of #12215, my example doesn't add any significant value to it.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants