Skip to content
This repository was archived by the owner on May 12, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openrewrite/src/javascript/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3426,7 +3426,7 @@ export class FunctionDeclaration extends JSMixin(Object) implements Statement, E
}

@LstType("org.openrewrite.javascript.tree.JS$TypeLiteral")
export class TypeLiteral extends JSMixin(Object) implements Expression, TypedTree {
export class TypeLiteral extends JSMixin(Object) implements Expression, TypeTree {
public constructor(id: UUID, prefix: Space, markers: Markers, members: Java.Block, _type: JavaType | null) {
super();
this._id = id;
Expand Down
16 changes: 8 additions & 8 deletions openrewrite/test/javascript/parser/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ describe('function mapping', () => {
);
});

test.skip('parameter with anonymous type', () => {
test('parameter with anonymous type', () => {
rewriteRun(
//language=typescript
typeScript(`
function create<Type>(c: { new (): Type }): Type {
return new c();
}
`)
function create<Type>(c: { new (): Type }): Type {
return new c();
}
`)
);
});

Expand All @@ -170,7 +170,7 @@ describe('function mapping', () => {
(function() {
console.log('IIFE');
})();
`)
`)
);
});

Expand All @@ -183,7 +183,7 @@ describe('function mapping', () => {
var hello = function hello() {
return helloString;
};
`)
`)
);
});

Expand All @@ -196,7 +196,7 @@ describe('function mapping', () => {
var hello = /*a*/function/*b*/ hello /*c*/(/*d*/) {
return helloString;
};
`)
`)
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3105,31 +3105,27 @@ public FunctionDeclaration withParameters(JContainer<Statement> parameters) {
}


@Getter
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
@EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true)
@RequiredArgsConstructor
final class TypeLiteral implements JS, Expression, TypedTree {
final class TypeLiteral implements JS, Expression, TypeTree {

@With
@EqualsAndHashCode.Include
@Getter
UUID id;

@With
@Getter
Space prefix;

@With
@Getter
Markers markers;

@With
@Getter
J.Block members;

@Nullable
@With
@Getter
JavaType type;

@Override
Expand Down