diff --git a/lib/printer.ts b/lib/printer.ts index eaaf0ef4..18cd89ba 100644 --- a/lib/printer.ts +++ b/lib/printer.ts @@ -2746,6 +2746,10 @@ function printMethod(path: any, options: any, print: any) { parts.push("abstract "); } + if (node.override) { + parts.push("override "); + } + if (node.readonly) { parts.push("readonly "); } diff --git a/test/typescript.ts b/test/typescript.ts index 9a424aa9..4281539d 100644 --- a/test/typescript.ts +++ b/test/typescript.ts @@ -257,6 +257,14 @@ const nodeMajorVersion = parseInt(process.versions.node, 10); "}", ]); + check([ + "class Dog extends Animal {", + " protected override getSound() {", + " return 'bark';", + " }", + "}", + ]) + check(["export interface S {", " i(s: string): boolean", "}"]); check([