Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,8 @@ namespace ts {
writeIfPresent(node.dotDotDotToken, "...");
emit(node.name);
writeIfPresent(node.questionToken, "?");
emitExpressionWithPrefix(" = ", node.initializer);
emitWithPrefix(": ", node.type);
emitExpressionWithPrefix(" = ", node.initializer);
}

function emitDecorator(decorator: Decorator) {
Expand Down
3 changes: 3 additions & 0 deletions src/harness/unittests/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ namespace ts {

// comment9
console.log(1 + 2);

// comment10
function functionWithDefaultArgValue(argument: string = "defaultValue"): void { }
`, ScriptTarget.ES2015);

printsCorrectly("default", {}, printer => printer.printFile(sourceFile));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ const enum E2 {
}
// comment9
console.log(1 + 2);
// comment10
function functionWithDefaultArgValue(argument: string = "defaultValue"): void { }
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ const enum E2 {
second
}
console.log(1 + 2);
function functionWithDefaultArgValue(argument: string = "defaultValue"): void { }