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
This is because {} is a supertype of string. The object type has the same structure implied by {}, but explicitly rejects direct compatibility with primitives like string.
TypeScript Version: 3.8.3, Nightly
Search Terms: nullish coalescing operator, type inference
Code
Expected behavior:
type of b should inferred as: {} | ""
Actual behavior:
type of b is inferred as: {}
Playground Link: Provided
Related Issues: #36393
The text was updated successfully, but these errors were encountered: