Skip to content
This repository was archived by the owner on May 12, 2025. It is now read-only.

Commit 28e36d9

Browse files
arodionovAndrii Rodionov
andauthored
Wrap clazz into TypeTreeExpression (#183)
Co-authored-by: Andrii Rodionov <[email protected]>
1 parent e025613 commit 28e36d9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

openrewrite/src/javascript/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,7 @@ export class JavaScriptParserVisitor {
19411941
randomId(),
19421942
Space.EMPTY,
19431943
Markers.EMPTY,
1944-
this.visit(node.expression),
1944+
new TypeTreeExpression(randomId(), Space.EMPTY, Markers.EMPTY, this.visit(node.expression)),
19451945
this.mapTypeArguments(this.prefix(this.findChildNode(node, ts.SyntaxKind.LessThanToken)!), node.typeArguments),
19461946
null
19471947
): new TypeTreeExpression(randomId(), Space.EMPTY, Markers.EMPTY, this.visit(node.expression)),

openrewrite/test/javascript/parser/expressionStatement.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,13 @@ describe('expression statement mapping', () => {
214214
);
215215
});
216216

217+
test('new expression with array access', () => {
218+
rewriteRun(
219+
//language=typescript
220+
typeScript(`
221+
const results = new this.constructor[Symbol.species]<Key, Value>();
222+
`)
223+
);
224+
});
225+
217226
});

0 commit comments

Comments
 (0)