-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Satisfies operator doesnt carry over optional properties #52805
Comments
Workaround is to set the values as undefined explicitly.
|
This is the intended behavior of the satisfies operator. See discussion at #47920 |
Huh, I recall that the primary debate over To OP: Note that explicitly setting to |
It would be nice to have some way to define that a constant variable conforms to some type and would carry over the type. @RyanCavanaugh Maybe could be a new feature request? or what are your thoughts on this topic? |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Bug Report
🔎 Search Terms
satisfies, optional property
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Readonly literal types that satisfy a type don't carry over optional properties that might not be set. Setting the type directly would mean we lose the literal types.
🙂 Expected behavior
Optional properties are carried over when a const satisfies some type. Expected type of
listA
is{ id: 'foo', label: 'Foo', disabled?: boolean }[]
The text was updated successfully, but these errors were encountered: