SonarJS linter helper functions
    Preparing search index...

    Function getValueOfExpression

    • Type Parameters

      • T extends
            | "FunctionDeclaration"
            | "FunctionExpression"
            | "ArrowFunctionExpression"
            | "MethodDefinition"
            | "CatchClause"
            | "ClassBody"
            | "Identifier"
            | "Literal"
            | "PrivateIdentifier"
            | "Program"
            | "Property"
            | "PropertyDefinition"
            | "SpreadElement"
            | "Super"
            | "SwitchCase"
            | "TemplateElement"
            | "VariableDeclarator"
            | "ArrayExpression"
            | "AssignmentExpression"
            | "AwaitExpression"
            | "BinaryExpression"
            | "CallExpression"
            | "ChainExpression"
            | "ClassExpression"
            | "ConditionalExpression"
            | "ImportExpression"
            | "LogicalExpression"
            | "MemberExpression"
            | "MetaProperty"
            | "NewExpression"
            | "ObjectExpression"
            | "SequenceExpression"
            | "TaggedTemplateExpression"
            | "TemplateLiteral"
            | "ThisExpression"
            | "UnaryExpression"
            | "UpdateExpression"
            | "YieldExpression"
            | "ClassDeclaration"
            | "ImportDeclaration"
            | "ExportNamedDeclaration"
            | "ExportDefaultDeclaration"
            | "ExportAllDeclaration"
            | "ImportSpecifier"
            | "ImportDefaultSpecifier"
            | "ImportNamespaceSpecifier"
            | "ExportSpecifier"
            | "ObjectPattern"
            | "ArrayPattern"
            | "RestElement"
            | "AssignmentPattern"
            | "ExpressionStatement"
            | "BlockStatement"
            | "StaticBlock"
            | "EmptyStatement"
            | "DebuggerStatement"
            | "WithStatement"
            | "ReturnStatement"
            | "LabeledStatement"
            | "BreakStatement"
            | "ContinueStatement"
            | "IfStatement"
            | "SwitchStatement"
            | "ThrowStatement"
            | "TryStatement"
            | "WhileStatement"
            | "DoWhileStatement"
            | "ForStatement"
            | "ForInStatement"
            | "ForOfStatement"
            | "VariableDeclaration"

      Parameters

      • context: RuleContext
      • expr: undefined | null | Node
      • type: T
      • recursive: boolean = false

      Returns
          | undefined
          | Extract<MethodDefinition, { type: T }>
          | Extract<AssignmentProperty, { type: T }>
          | Extract<Property, { type: T }>
          | Extract<CatchClause, { type: T }>
          | Extract<ClassDeclaration, { type: T }>
          | Extract<ClassExpression, { type: T }>
          | Extract<ClassBody, { type: T }>
          | Extract<FunctionExpression, { type: T }>
          | Extract<ArrowFunctionExpression, { type: T }>
          | Extract<Identifier, { type: T }>
          | Extract<SimpleLiteral, { type: T }>
          | Extract<RegExpLiteral, { type: T }>
          | Extract<BigIntLiteral, { type: T }>
          | Extract<ArrayExpression, { type: T }>
          | Extract<AssignmentExpression, { type: T }>
          | Extract<AwaitExpression, { type: T }>
          | Extract<BinaryExpression, { type: T }>
          | Extract<SimpleCallExpression, { type: T }>
          | Extract<NewExpression, { type: T }>
          | Extract<ChainExpression, { type: T }>
          | Extract<ConditionalExpression, { type: T }>
          | Extract<ImportExpression, { type: T }>
          | Extract<LogicalExpression, { type: T }>
          | Extract<MemberExpression, { type: T }>
          | Extract<MetaProperty, { type: T }>
          | Extract<ObjectExpression, { type: T }>
          | Extract<SequenceExpression, { type: T }>
          | Extract<TaggedTemplateExpression, { type: T }>
          | Extract<TemplateLiteral, { type: T }>
          | Extract<ThisExpression, { type: T }>
          | Extract<UnaryExpression, { type: T }>
          | Extract<UpdateExpression, { type: T }>
          | Extract<YieldExpression, { type: T }>
          | Extract<FunctionDeclaration, { type: T }>
          | Extract<ImportDeclaration, { type: T }>
          | Extract<ExportNamedDeclaration, { type: T }>
          | Extract<ExportDefaultDeclaration, { type: T }>
          | Extract<ExportAllDeclaration, { type: T }>
          | Extract<ImportSpecifier, { type: T }>
          | Extract<ImportDefaultSpecifier, { type: T }>
          | Extract<ImportNamespaceSpecifier, { type: T }>
          | Extract<ExportSpecifier, { type: T }>
          | Extract<ObjectPattern, { type: T }>
          | Extract<ArrayPattern, { type: T }>
          | Extract<RestElement, { type: T }>
          | Extract<AssignmentPattern, { type: T }>
          | Extract<PrivateIdentifier, { type: T }>
          | Extract<Program, { type: T }>
          | Extract<PropertyDefinition, { type: T }>
          | Extract<SpreadElement, { type: T }>
          | Extract<ExpressionStatement, { type: T }>
          | Extract<BlockStatement, { type: T }>
          | Extract<StaticBlock, { type: T }>
          | Extract<EmptyStatement, { type: T }>
          | Extract<DebuggerStatement, { type: T }>
          | Extract<WithStatement, { type: T }>
          | Extract<ReturnStatement, { type: T }>
          | Extract<LabeledStatement, { type: T }>
          | Extract<BreakStatement, { type: T }>
          | Extract<ContinueStatement, { type: T }>
          | Extract<IfStatement, { type: T }>
          | Extract<SwitchStatement, { type: T }>
          | Extract<ThrowStatement, { type: T }>
          | Extract<TryStatement, { type: T }>
          | Extract<WhileStatement, { type: T }>
          | Extract<DoWhileStatement, { type: T }>
          | Extract<ForStatement, { type: T }>
          | Extract<ForInStatement, { type: T }>
          | Extract<ForOfStatement, { type: T }>
          | Extract<VariableDeclaration, { type: T }>
          | Extract<Super, { type: T }>
          | Extract<SwitchCase, { type: T }>
          | Extract<TemplateElement, { type: T }>
          | Extract<VariableDeclarator, { type: T }>