You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You forgot fill out the issue template completely.
This is working as intended. Non-union types are not narrowed upon assignment. Duplicate of or strongly related to #16976 Edit: I missed the point here, the ask is not that meow be narrowed to "domain1", but that it presumably should be narrowed to keyof typeof hosts.
Assuming this worked (allowing arbitrary strings as indexers after an in check), objects can legally have extra properties thanks to structural subtyping—so what is the type of hosts[meow] then?
Example:
Playground:
https://www.typescriptlang.org/play?#code/MYewdgzgLgBAtgUxAdwFw2gJwJZgOYwC8MA5ACYhwCGuAjCQFAOiSwAWI0ERMA3gzEEwARBWp1h6XqAA2ITOhKYEZEgF8ANAKGjKNMACZJfWfMUAjGQFcE6rWqbYAZgApEKGLhgcuASj7a3pxQEADa7sgAugwOQA
Expected behavior:
meow
can be used to indexhosts
if verification within
operator is done.The text was updated successfully, but these errors were encountered: