-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Type assertion does not creates a type union anymore #54883
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
Labels
Duplicate
An existing issue was already created
Comments
|
Indeed.
Indeed, I'm not allowed to update the post content however. |
Adding a self-contained repro so this can be bisected... type Dinero = {
mul: () => number
}
declare const isDinero: (obj: unknown) => obj is Dinero;
const transformValues = <Contract extends object>(contract : Contract) => {
let value: Contract[keyof Contract] = null as any;
if(isDinero(value)) {
value.mul()
}
} |
The change between origin/release-5.0 and origin/release-5.1 occurred at 84a09c7. |
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Since version 5.1.X I am facing this issue with type assertion. In version 5.0.X the type resolves with an Union of the original type & the assertion type. However in 5.1.X there is only the original type left
🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
The type value is
Contract[keyof Contract
🙂 Expected behavior
The type value to be at least
Contract[keyof Contract] & Dinero
The text was updated successfully, but these errors were encountered: