Skip to content

Commit

Permalink
Merge pull request #1151 from 625dennis/fix-typescript-override-keywo…
Browse files Browse the repository at this point in the history
…rd-printer

Fix typescript override keyword printer
  • Loading branch information
eventualbuddha authored Sep 27, 2022
2 parents 05dde87 + bc030e5 commit 295d7c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ");
}
Expand Down
8 changes: 8 additions & 0 deletions test/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit 295d7c8

Please sign in to comment.