-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Woodpile37/TypeScript
#10Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
If a type annotation is present it should be emitted exactly as written when generating a .d.ts file. For example:
module M {
export type Value = string | number | boolean;
export var x: Value;
}The .d.ts file for the above is currently emitted as:
module M {
export type Value = string | number | boolean;
export var x: string | number | boolean;
}The type annotation on x should be preserved and emitted exactly as written. Specifically, the declaration file emitter should only emit from Type objects when dealing with inferred types.
The current scheme of always emitting from Type objects actually leads to errors.
module M {
type W = Window | string;
export module N {
export class Window { }
export var p: W;
}
}Here, an error occurs when the emitter tries to emit Window | string in place of the W type annotation.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue