-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this
Milestone
Description
TypeScript Version: nightly (2.4.0-dev.20170519)
Code
const code = `
declare class X {
method?(): void;
property?: string;
}
type Y = {
method?(): void;
property?: string;
}
`;
const parsed = ts.createSourceFile('path/to/somewhere', code, ts.ScriptTarget.Latest, /*setParentNodes */ false);
const emitted = ts.createPrinter().printNode(ts.EmitHint.Unspecified, parsed,'');Expected behavior:
emitted to be same as code
Actual behavior:
emitted to be
declare class X {
method(): void; // <-- missing questionToken
property: string; // <-- missing questionToken
}
type Y = {
method?(): void;
property?: string;
}Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this