UNPKG

cognitive-complexity-ts

Version:

This program analyses TypeScript and JavaScript code according to the [Cognitive Complexity metric](https://www.sonarsource.com/docs/CognitiveComplexity.pdf). It produces a JSON summary and a GUI for exploring the complexity of your codebase.

23 lines (22 loc) 776 B
import ts from "typescript"; /** * Contains all names that could be recursively referenced. */ export declare class Scope { /** * Variables that can be referenced as is from a scope. */ readonly local: ReadonlyArray<string>; /** * Variables that can only be referenced with a prefix in the scope. */ readonly object: ReadonlyArray<string>; constructor(local: ReadonlyArray<string>, object: ReadonlyArray<string>); includes(name: string): boolean; /** * @returns a new scope with the identifier from the node included, * or if there is no identifier, it returns the scope not modified nor cloned */ maybeAdd(node: ts.Node, variableBeingDefined: string | undefined): Scope; private scopeToAdd; }