Skip to content

Commit 1e9e147

Browse files
committed
fix: resolve TypeScript type compatibility issues
1 parent f101067 commit 1e9e147

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

recipes/crypto-rsa-pss-update/src/workflow.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { SgRoot, SgNode, Edit } from "@codemod.com/jssg-types/main";
1+
import type { SgRoot, SgNode, Edit, TypesMap, Kinds } from "@codemod.com/jssg-types/main";
22
import type JS from "@codemod.com/jssg-types/langs/javascript";
33
import { getNodeImportStatements } from "@nodejs/codemod-utils/ast-grep/import-statement";
44
import { getNodeRequireCalls } from "@nodejs/codemod-utils/ast-grep/require-call";
@@ -81,7 +81,7 @@ function getPromisifiedBindings(root: SgRoot<JS>, existingBindings: string[]): s
8181
);
8282
}
8383

84-
function findCryptoCalls(rootNode: SgNode<JS>, bindings: string[]) {
84+
function findCryptoCalls(rootNode: SgNode<JS>, bindings: string[]): SgNode<JS>[] {
8585
return bindings
8686
.flatMap(bindingName => rootNode.findAll({
8787
rule: {
@@ -99,8 +99,8 @@ function getText(node: SgNode<JS> | undefined): string | null {
9999
}
100100

101101
function getModuleStatements(root: SgRoot<JS>, moduleName: string): SgNode<JS>[] {
102-
const importStatements = getNodeImportStatements(root, moduleName);
103-
const requireCalls = getNodeRequireCalls(root, moduleName);
102+
const importStatements = getNodeImportStatements(root as unknown as SgRoot, moduleName);
103+
const requireCalls = getNodeRequireCalls(root as unknown as SgRoot, moduleName);
104104
return [...importStatements, ...requireCalls] as unknown as SgNode<JS>[];
105105
}
106106

@@ -110,7 +110,7 @@ function resolveBindings(statements: SgNode<JS>[], paths: string | string[]): st
110110

111111
return statements.flatMap(stmt =>
112112
pathArray
113-
.map(path => resolveBindingPath(stmt, path))
113+
.map(path => resolveBindingPath(stmt as unknown as SgNode<TypesMap, Kinds<TypesMap>>, path))
114114
.filter(Boolean)
115115
);
116116
}

0 commit comments

Comments
 (0)