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

OverrideProperties changes undefined as optional #858

Closed
CarinaChenot opened this issue Apr 8, 2024 · 2 comments
Closed

OverrideProperties changes undefined as optional #858

CarinaChenot opened this issue Apr 8, 2024 · 2 comments

Comments

@CarinaChenot
Copy link

CarinaChenot commented Apr 8, 2024

Considering this:

import { OverrideProperties } from 'type-fest';

type Original = {
  foo: string;
  bar: string;
};

type Modified = {
  foo: string | undefined;
  bar: string;
};

const test: OverrideProperties<Original, Modified> = { bar: '' };

foo is typed as foo?: string instead of foo: string | undefined

CleanShot 2024-04-08 at 09 01 13@2x

This is particularly problematic when using exactOptionalPropertyTypes flag

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
sindresorhus added a commit that referenced this issue Apr 8, 2024
@sindresorhus
Copy link
Owner

Are you on the latest type-fest version?

I added a test for your case and it is passing: 2547a00

@CarinaChenot
Copy link
Author

@sindresorhus Indeed, issue went away with 4.10.0 my bad, thank you!

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

No branches or pull requests

2 participants