diff --git a/lib/printer.ts b/lib/printer.ts index df020115..dee5dffa 100644 --- a/lib/printer.ts +++ b/lib/printer.ts @@ -2333,6 +2333,12 @@ function genericPrintNoParens(path: any, options: any, print: any) { return concat(parts); case "TSMethodSignature": + if (n.kind === "get") { + parts.push("get "); + } else if (n.kind === "set") { + parts.push("set "); + } + if (n.computed) { parts.push("[", path.call(print, "key"), "]"); } else { diff --git a/test/typescript.ts b/test/typescript.ts index ddbce81a..1a3dc9b6 100644 --- a/test/typescript.ts +++ b/test/typescript.ts @@ -251,6 +251,13 @@ const nodeMajorVersion = parseInt(process.versions.node, 10); "}", ]); + check([ + "interface LabelledContainer {", + " get label(): string;", + " set label(a: string);", + "}", + ]); + check([ "class Button extends Control implements SelectableControl, ClickableControl {", " select() {}",