-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts files
Milestone
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
robpalme, so1ve and dragomirtitian
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts files