add builder for TSConstructorType
MODIFY
packages/@romejs/js-formatter/builders/types/TemplateLiteralTypeAnnotation.ts
packages/@romejs/js-formatter/builders/types/TemplateLiteralTypeAnnotation.ts
* LICENSE file in the root directory of this source tree.
*/
+import { TemplateLiteralTypeAnnotation} from '@romejs/js-ast';
+import { Builder } from '@romejs/js-formatter';
import {Token} from '../../tokens';
+import { escapeString } from '@romejs/string-escape';
-export default function TemplateLiteralTypeAnnotation(): Token {
- throw new Error('unimplemented');
+export default function TemplateLiteralTypeAnnotation(
+ builder: Builder,
+ node: TemplateLiteralTypeAnnotation
+): Token {
+ return escapeString(node.value, {quote: '`'});
}

MODIFY
packages/@romejs/js-formatter/builders/typescript/TSConstructorType.ts
packages/@romejs/js-formatter/builders/typescript/TSConstructorType.ts
* LICENSE file in the root directory of this source tree.
*/
-import {Token} from '../../tokens';
+import { Builder } from '@romejs/js-formatter';
+import { TSConstructorType } from '@romejs/js-ast';
+import {Token, space, concat} from '../../tokens';
-export default function TSConstructorType(): Token {
- throw new Error('unimplemented');
+export default function TSConstructorType(
+ builder: Builder,
+ node: TSConstructorType
+): Token {
+ const tokens: Array<Token> = ['new', space, builder.tokenize(node.meta, node)];
+
+ if (node.typeAnnotation) {
+ tokens.push(space, '=>', space, builder.tokenize(node.typeAnnotation, node));
+ }
+
+ return concat(tokens);
}

ADD
packages/@romejs/js-formatter/test-fixtures/typescript/tsConstructorType/input.test.md
+# `index.test.ts`
+
+**DO NOT MODIFY**. This file has been autogenerated. Run `rome test packages/@romejs/js-formatter/index.test.ts --update-snapshots` to update.
+
+## `typescript > tsConstructorType`
+
+### `Input`
+
+```javascript
+// type Class<T> = new (...args: any) => T;
+// let d: new(x: number) => void;
+```
+
+### `Output`
+
+```javascript
+// type Class<T> = new (...args: any) => T;
+// let d: new(x: number) => void;
+
+```

ADD
packages/@romejs/js-formatter/test-fixtures/typescript/tsConstructorType/input.ts
+// type Class<T> = new (...args: any) => T;
+// let d: new(x: number) => void;
\ No newline at end of file

add builder for TSConstructorType