Open
Description
π Search Terms
declaration, widened, d.ts, destructuring
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries
β― Playground Link
π» Code
function foo(): {y: 1} {
return { y: 1 }
}
export const { y = 0 } = foo();
π Actual behavior
y
is number
in d.ts
files, although the language service says y
is 1|0
π Expected behavior
y
is 1|0
in d.ts
files.
Additional information about the issue
Without the = 0
assignment y
properly becomes type 1
in d.ts