Description
A class that shares common utilities between all reflected nodes
Methods
-
getProgram
codeA Program is an immutable collection of source files and the compiler options. Together represent a compilation unit.
getProgram(): ProgramReturns
Program:The TypeScript program created with the TypeScript compiler API
-
getCommandLine
codeThe TypeScript compiler options parsed (if you have a TSConfig file, the parsed options will be the ones defined there)
getCommandLine(): ParsedCommandLineReturns
ParsedCommandLine:The parsed compiler options
-
getTypeChecker
codeThe TypeScript type checker. Useful to resolve the types and location of the reflected nodes.
getTypeChecker(): TypeCheckerReturns
TypeChecker:The TypeScript type checker
-
getSystem
codeAn abstraction layer around how we interact with the environment (browser or Node.js)
getSystem(): AnalyserSystemReturns
AnalyserSystem:The system environment used
-
getDiagnostics
codeHere we save all the errors we find while analysing the source files
getDiagnostics(): AnalyserDiagnosticReturns
AnalyserDiagnostic:An instance of the
AnalyserDiagnosticwhere all errors are enqueue -
getOptions
codeThe user provided analyzer options.
getOptions(): Partial<AnalyserOptions>Returns
Partial<AnalyserOptions>:The options that were provided when calling the parser function
-
registerReflectedNode
codeCreates a new reflected node only if it doesn’t exist already in the internal cache.
registerReflectedNode<T extends ReflectedNode<object, Node>>(node: Node, reflectedNodeFactory: () => T): TParameters
node NodeThe
ts.Nodeassociated with the reflected nodereflectedNodeFactory () => TThe function to use to build the new reflection if it doesn’t exist
Returns
T:The reflected node instance
-
getSymbol
codeReturns the associated
ts.Symbolfor the given nodegetSymbol(node: Node): Symbol | nullParameters
node NodeThe
ts.Nodeto search its symbolReturns
Symbol | null:The symbol if it has one
-
getLocation
codeGiven a node or a type it returns it’s associated symbol, line position and the file path where it was defined.
getLocation(nodeOrType: Node | Type): SymbolWithLocationParameters
nodeOrType Node | TypeThe node or type to search for
Returns
SymbolWithLocation:The symbol, line position and path where the node/type is located
-
getLinePosition
codeReturns the start line number where the node is located
getLinePosition(node: Node): numberParameters
node NodeThe node to locate
Returns
number:The line number where the node is located