diff --git a/src/transforms/replace.ts b/src/transforms/replace.ts index 3349701..91c1fa0 100644 --- a/src/transforms/replace.ts +++ b/src/transforms/replace.ts @@ -10,13 +10,13 @@ export const replace = ( const visitor = (node: ts.Node): ts.VisitResult => { if (ts.isVariableStatement(node)) { const name = node.declarationList.declarations[0]?.name; - if (isIdentifier(name) && name.text in replacements) { + if (isIdentifier(name) && replacements.hasOwnProperty(name.text)) { const key = name.text as keyof typeof replacements; return ast(replacements[key]); } } else if (ts.isFunctionDeclaration(node)) { const name = node.name; - if (name && isIdentifier(name) && name.text in replacements) { + if (name && isIdentifier(name) && replacements.hasOwnProperty(name.text)) { const key = name.text as keyof typeof replacements; return astNodes(replacements[key]); }