Skip to content
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

Proposal: Overwrite<Obj, Props> #276

Closed
rattrayalex opened this issue Oct 4, 2021 · 2 comments
Closed

Proposal: Overwrite<Obj, Props> #276

rattrayalex opened this issue Oct 4, 2021 · 2 comments

Comments

@rattrayalex
Copy link

rattrayalex commented Oct 4, 2021

Roughly this:

type Overwrite<Obj extends {}, Props extends {}> = Omit<Obj, keyof Props> & Props;

To be used like so:

type Foo = {
  a: string,
  b: number,
}
type Bar = Overwrite<Foo, {
  b: string,
}>
// Bar == { a: string, b: string }

This exists in utility-types.

@sindresorhus sindresorhus changed the title request: Overwrite<Obj, Props> Proposal: Overwrite<Obj, Props> Oct 6, 2021
@sindresorhus
Copy link
Owner

Isn't this the same as Merge?

@rattrayalex
Copy link
Author

Ah, so it is! My mistake. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants