diff --git a/src/gen.ts b/src/gen.ts index f7d8fc9..5b9a45a 100644 --- a/src/gen.ts +++ b/src/gen.ts @@ -738,12 +738,10 @@ export function gen( const context = last(lexerContext) const symbol = checker.getSymbolAtLocation(id) const isDeclarationOutsideOfFunction = - symbol && - symbol.valueDeclaration && + symbol?.valueDeclaration && isOutOfFunction(symbol.valueDeclaration) const isImportedSymbolOutsideOfFunction = - symbol && - symbol.declarations && + symbol?.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === ts.SyntaxKind.ImportSpecifier && isOutOfFunction(symbol.declarations[0])