Skip to content

Commit

Permalink
fix for breaking other transformers
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrconley committed Dec 20, 2023
1 parent f4d6eeb commit 30acf8a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export abstract class NodeTransformer {
context: ts.TransformationContext,
): ts.Node {
if (ts.isClassDeclaration(node)) {
return ClassTransformer.transform(project, source, ts.getOriginalNode(node) as ts.ClassDeclaration, context);
return ClassTransformer.transform(project, source, node as ts.ClassDeclaration, context);
}

return node;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export abstract class ChainRouteProcessor {
);

ts.setTextRange(recreatedNode, node);
ts.setOriginalNode(recreatedNode, node);
// ts.setOriginalNode(recreatedNode, node);

return recreatedNode;
}
Expand All @@ -126,7 +126,7 @@ export abstract class ChainRouteProcessor {
}

private static parseJSDoc(_project: Project, method: ts.MethodDeclaration): RouteTags {
const docs = ts.getJSDocCommentsAndTags(ts.getOriginalNode(method));
const docs = ts.getJSDocCommentsAndTags(method);
const topLevel = docs[0];
if (!topLevel) {
return {};
Expand Down Expand Up @@ -239,8 +239,8 @@ export abstract class ChainRouteProcessor {
methodDeclaration: ts.MethodDeclaration,
routeIndex: RouteIndex,
): { type: ts.Type; node: ts.TypeNode } {
const wrapped = tsp.createWrappedNode(methodDeclaration, { typeChecker: project.checker });
const returnedTypeNode = wrapped.getReturnTypeNode()?.compilerNode;
const returnedTypeNode = methodDeclaration.type;

if (returnedTypeNode == null) {
throw new TransformationError(
"Endpoint is missing an explicit return type. Explicit return types are required for all endpoints to promote contract stability",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export abstract class ControllerProcessor {
);

ts.setTextRange(recreatedNode, node);
ts.setOriginalNode(recreatedNode, node);
// ts.setOriginalNode(recreatedNode, node);

return recreatedNode;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/test/src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class TestController {
/**
* Cool get route
*/
@GetChain("/route/{cool}")
@GetChain("/route/:cool")
public getRoute(chain: Nornir<RouteGetInput>): Nornir<RouteGetInput, RouteGetOutput> {
return chain
.use(input => {
Expand All @@ -188,7 +188,7 @@ export class TestController {
* @deprecated
* @operationId coolRoute
*/
@PostChain("/route/{cool}")
@PostChain("/route/:cool")
public postRoute(
chain: Nornir<RoutePostInput>,
): Nornir<RoutePostInput, { statusCode: HttpStatusCode.Ok; headers: NonNullable<unknown> }> {
Expand Down

0 comments on commit 30acf8a

Please sign in to comment.