Skip to content

Commit

Permalink
fix functionLike node get wrong type name
Browse files Browse the repository at this point in the history
Signed-off-by: Su Yihan <[email protected]>
  • Loading branch information
yviansu committed Jan 8, 2024
1 parent b8e87d8 commit 3f9f0c3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,13 @@ export class TypeResolver {
}

getTsTypeName(node: ts.Node) {
let tsTypeString = this.getTsTypeRawName(node);
let tsTypeString: string | undefined = undefined;
if (ts.isFunctionLike(node)) {
/* if node is function like, then it must stored in nodeTypeCache */
tsTypeString = this.nodeTypeCache.get(node)!.toString();
} else {
tsTypeString = this.getTsTypeRawName(node);
}
if (!tsTypeString) {
tsTypeString = this.typechecker!.typeToString(
this.typechecker!.getTypeAtLocation(node),
Expand Down

0 comments on commit 3f9f0c3

Please sign in to comment.