-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Incorrect type inference for a field that is not optional, but has type of a union with undefined #524
Labels
Status: Released
It's now live.
Type: Bug
Inconsistencies or issues which will cause a problem for users or implementors.
Comments
vladislavsheludchenkov
added
Status: Triage
This issue needs to be triaged.
Type: Bug
Inconsistencies or issues which will cause a problem for users or implementors.
labels
Jan 22, 2025
RebeccaStevens
added a commit
that referenced
this issue
Jan 23, 2025
RebeccaStevens
added a commit
that referenced
this issue
Jan 23, 2025
RebeccaStevens
added a commit
that referenced
this issue
Jan 23, 2025
RebeccaStevens
added a commit
that referenced
this issue
Jan 23, 2025
Those using the `DeepMergeLeaf` type directly must now pass the `Fs` and `M` type parameters to this type. fixes #524
🎉 This issue has been resolved in version 7.1.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Status: Released
It's now live.
Type: Bug
Inconsistencies or issues which will cause a problem for users or implementors.
Bug Report
Actual behavior
If there is a non-optional attribute in an object that has a type of
something | undefined
, the logic that is skippingundefined
is not reflected in the type, but still works in runtime:That results in a compile-time type diverging from a runtime type (in the example, it's
string
in runtime andnumber | undefined
in compile-time)The issue is not there if the field is marked as optional:
Expected behavior
The logic that filters out
undefined
should be reflected in the type even if an optional field is represented via union, and not using a?
:The text was updated successfully, but these errors were encountered: