Closed
Description
Bug Report
π Search Terms
empty object, {}, inferred type
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ
β― Playground Link
Playground link with relevant code
π» Code
const x = true ? 'I am a string' : {} // type of `x` is: {}
π Actual behavior
Type of x
is inferred as {}
π Expected behavior
Type of x
should be inferred as "I am a string" | {}
.
For example, if we try this code:
const x = true ? 'I am a string' : 5
...the type of x
is inferred as "I am a string" | 5