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
Add OverrideProperties
type
#597
Add OverrideProperties
type
#597
Conversation
Thanks for contributing. Make sure you adhere to: https://github.com/sindresorhus/type-fest/blob/main/.github/contributing.md#submitting-a-new-type |
sure, I thought I did. |
It takes a lot of effort to review all new pull requests. If people submitting new types could also help review other pull requests, it would lighten my load. 🙏 |
type Baz = OverrideProperties<Foo, {c: number}> | ||
// error TS2559: Type '{c: number}' has no properties in common with type 'Partial{a: unknown; b: unknown}>'. | ||
``` | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add categories. See other types for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see that, thanks for pointing out
source/override-properties.d.ts
Outdated
import type {Merge} from './merge'; | ||
|
||
/** | ||
Override existing property types in TOriginal with the types in TOverride. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should match the readme description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I also rearranged the entry in the readme to be right after the merge types.
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Thanks :) |
Adds the
OverrideProperties
type.It is basically a
Merge
with the constraint, that you can only override properties.Example: