Skip to content

Commit

Permalink
feature: @putout/printer: ClassMethod: scoped constructor (coderaiser…
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Jul 27, 2023
1 parent 56ef7dd commit ffed3e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/tokenize/expressions/functions/class-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const ClassMethod = {
const isMethod = kind === 'method';
const isGetter = /get|set/.test(kind);

maybe.print(isConstructor, kind);
maybe.print(generator, '*');

if (accessibility) {
Expand All @@ -32,6 +31,8 @@ const ClassMethod = {
print(' ');
}

maybe.print(isConstructor, kind);

if (isMethod) {
maybe.print(computed, '[');
print('__key');
Expand Down
3 changes: 3 additions & 0 deletions lib/tokenize/typescript/fixture/scoped-constructor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default class Test {
private constructor(x: number, y: number) {}
}
5 changes: 5 additions & 0 deletions lib/tokenize/typescript/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,8 @@ test('printer: tokenizer: typescript: static-property', (t) => {
t.print(fixture.staticProperty);
t.end();
});

test('printer: tokenizer: typescript: scopedConstructor', (t) => {
t.print(fixture.scopedConstructor);
t.end();
});

0 comments on commit ffed3e0

Please sign in to comment.