Options
All
  • Public
  • Public/Protected
  • All
Menu

typescript-parser

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

Generatable

All generatable items combined. If the element is not generatable, the specific generator should throw an exception.

Generators

Generators: object

Type for generators.

Type declaration

IndexDelta

IndexDelta: object

IndexDelta type, is calculated by the declaration index to give an overview, what has changed in the index. Returns a list of deleted declarations, newly added declarations (with the corresponding infos) and which declarations have been updated (with all declarations under that name).

Type declaration

Resources

Resources: object

Helper type to index all possible resources of the current workspace.

Type declaration

Variables

Const defaultAliasOnlyMultiLineImportTemplate

defaultAliasOnlyMultiLineImportTemplate: function = stringTemplate`import ${0}from ${1}`

Type declaration

    • (...values: any[]): string
    • Parameters

      • Rest ...values: any[]

      Returns string

Const multiLineImportTemplate

multiLineImportTemplate: function = stringTemplate`import ${3}{${0}${1}} from ${2}`

Type declaration

    • (...values: any[]): string
    • Parameters

      • Rest ...values: any[]

      Returns string

Const oneLinerImportTemplate

oneLinerImportTemplate: function = stringTemplate`import ${0} from ${1}`

Type declaration

    • (...values: any[]): string
    • Parameters

      • Rest ...values: any[]

      Returns string

Const usageAllowedIfLast

usageAllowedIfLast: SyntaxKind[] = [SyntaxKind.Parameter,SyntaxKind.PropertyDeclaration,SyntaxKind.VariableDeclaration,SyntaxKind.BinaryExpression,]

Const usageNotAllowedParents

usageNotAllowedParents: SyntaxKind[] = [SyntaxKind.ImportEqualsDeclaration,SyntaxKind.ImportSpecifier,SyntaxKind.NamespaceImport,SyntaxKind.ClassDeclaration,SyntaxKind.ImportEqualsDeclaration,SyntaxKind.ImportClause,SyntaxKind.ImportDeclaration,SyntaxKind.InterfaceDeclaration,SyntaxKind.ExportDeclaration,SyntaxKind.ExportSpecifier,SyntaxKind.ImportSpecifier,SyntaxKind.FunctionDeclaration,SyntaxKind.EnumDeclaration,SyntaxKind.TypeAliasDeclaration,SyntaxKind.MethodDeclaration,]

Const usagePredicates

usagePredicates: function[] = [(o: Node) => o.parent !== undefined && usageNotAllowedParents.indexOf(o.parent.kind) === -1,allowedIfLastIdentifier,allowedIfPropertyAccessFirst,]

Functions

allowedIfLastIdentifier

  • allowedIfLastIdentifier(node: Node): boolean
  • Predicate function to determine if the node is possible as a "usage". Checks for the node identifier to be the last of the identifier list.

    Parameters

    • node: Node

    Returns boolean

allowedIfPropertyAccessFirst

  • allowedIfPropertyAccessFirst(node: Node): boolean
  • Predicate function to determine if the node is possible as a "usage". Checks if the identifier is on the lefthand side of a property access.

    Parameters

    • node: Node

    Returns boolean

containsModifier

  • containsModifier(node: Node, modifierKind: SyntaxKind): boolean
  • Checks if a node contains a certain modifier (of a given kind)

    export

    Parameters

    • node: Node
    • modifierKind: SyntaxKind

    Returns boolean

generateAccessorDeclaration

  • generateAccessorDeclaration(accessor: AccessorDeclaration, __namedParameters: object): string

generateExternalModuleImport

generateMethodDeclaration

  • generateMethodDeclaration(method: MethodDeclaration, __namedParameters: object): string

generateNamedImport

  • generateNamedImport(imp: NamedImport, __namedParameters: object): string

generateNamespaceImport

  • generateNamespaceImport(imp: NamespaceImport, __namedParameters: object): string

generateParameterDeclaration

generatePropertyDeclaration

  • generatePropertyDeclaration(property: PropertyDeclaration, __namedParameters: object): string

generateStringImport

  • generateStringImport(imp: StringImport, __namedParameters: object): string

generateSymbolSpecifier

generateVariableDelcaration

getDefaultResourceIdentifier

  • getDefaultResourceIdentifier(resource: Resource): string
  • Function that calculates the default name of a resource. This is used when a default export has no name (i.e. export class {}).

    export

    Parameters

    Returns string

getImportSpecifiers

  • getImportSpecifiers(namedImport: NamedImport, spaceBraces: boolean): string

getNodeLibraryName

  • getNodeLibraryName(path: string): string
  • Returns the name of the node folder. Is used as the library name for indexing. (e.g. ./node_modules/webpack returns webpack)

    Parameters

    • path: string

    Returns string

getNodeType

  • getNodeType(node: TypeNode | undefined): string | undefined
  • Returns the type text (type information) for a given node.

    export

    Parameters

    • node: TypeNode | undefined

    Returns string | undefined

getNodeVisibility

getVisibilityText

isAliasedImport

  • isAliasedImport(obj: any): boolean

isArrayBindingPattern

  • isArrayBindingPattern(node?: Node): boolean

isCallableDeclaration

  • isCallableDeclaration(obj: any): boolean

isConstructorDeclaration

  • isConstructorDeclaration(node?: Node): boolean

isExportDeclaration

  • isExportDeclaration(node?: Node): boolean

isExportableDeclaration

  • isExportableDeclaration(obj: any): boolean

isExternalModuleReference

  • isExternalModuleReference(node?: Node): boolean

isFunctionDeclaration

  • isFunctionDeclaration(node?: Node): boolean

isGetAccessorDeclaration

  • isGetAccessorDeclaration(node?: Node): boolean

isIdentifier

  • isIdentifier(node?: Node): boolean

isImportDeclaration

  • isImportDeclaration(node?: Node): boolean

isImportEqualsDeclaration

  • isImportEqualsDeclaration(node?: Node): boolean

isMethodDeclaration

  • isMethodDeclaration(node?: Node): boolean

isMethodSignature

  • isMethodSignature(node?: Node): boolean

isNamedExports

  • isNamedExports(node?: Node): boolean

isNamedImports

  • isNamedImports(node?: Node): boolean

isNamespaceImport

  • isNamespaceImport(node?: Node): boolean

isNodeDefaultExported

  • isNodeDefaultExported(node: Node): boolean
  • Checks if the given typescript node has the default flag. (e.g. export default class Foobar).

    export

    Parameters

    • node: Node

    Returns boolean

isNodeExported

  • isNodeExported(node: Node): boolean
  • Checks if the given typescript node has the exported flag. (e.g. export class Foobar).

    export

    Parameters

    • node: Node

    Returns boolean

isObjectBindingPattern

  • isObjectBindingPattern(node?: Node): boolean

isPropertyDeclaration

  • isPropertyDeclaration(node?: Node): boolean

isPropertySignature

  • isPropertySignature(node?: Node): boolean

isSetAccessorDeclaration

  • isSetAccessorDeclaration(node?: Node): boolean

isStringLiteral

  • isStringLiteral(node?: Node): boolean

normalizeFilename

  • normalizeFilename(filepath: string): string
  • Returns an adjusted and normalized filepath to use within the index. Essentially does remove .tsx .ts .js .jsx endings and other adjustments.

    export

    Parameters

    • filepath: string

    Returns string

normalizePathUri

  • normalizePathUri(uri: string): string
  • Returns a normalized version of the a path uri. Removes a "file://" or "file:///" prefix and removes semicolons.

    export

    Parameters

    • uri: string

    Returns string

parseClass

  • parseClass(tsResource: Resource, node: ClassDeclaration): void
  • Parses a class node into its declaration. Calculates the properties, constructors and methods of the class.

    export

    Parameters

    • tsResource: Resource
    • node: ClassDeclaration

    Returns void

parseClassIdentifiers

  • parseClassIdentifiers(tsResource: Resource, node: Node): void

parseCtorParams

  • parseCtorParams(parent: TshClass, ctor: TshConstructor, node: ConstructorDeclaration): void
  • Parse information about a constructor. Contains parameters and used modifiers (i.e. constructor(private name: string)).

    export

    Parameters

    • parent: TshClass
    • ctor: TshConstructor
    • node: ConstructorDeclaration

    Returns void

parseEnum

  • parseEnum(resource: Resource, node: EnumDeclaration): void

parseExport

  • parseExport(resource: Resource, node: ExportDeclaration | ExportAssignment): void

parseFunction

  • parseFunction(resource: Resource, node: FunctionDeclaration): void
  • Parses a function into its declaration. Parses the functions sub information like parameters and variables.

    export

    Parameters

    • resource: Resource
    • node: FunctionDeclaration

    Returns void

parseFunctionParts

  • parseFunctionParts(resource: Resource, parent: TshConstructor | TshMethod | TshFunction, node: Node): void
  • Parse the parts of a function. All functions / methods contain various information about used variables and parameters.

    export

    Parameters

    • resource: Resource
    • parent: TshConstructor | TshMethod | TshFunction
    • node: Node

    Returns void

parseIdentifier

  • parseIdentifier(resource: Resource, node: Identifier): void

parseImport

  • parseImport(resource: Resource, node: ImportDeclaration | ImportEqualsDeclaration): void

parseInterface

  • parseInterface(resource: Resource, node: InterfaceDeclaration): void
  • Parses an interface node into its declaration. Calculates the property and method defintions of the interface as well.

    export

    Parameters

    • resource: Resource
    • node: InterfaceDeclaration

    Returns void

parseMethodParams

  • parseMethodParams(node: FunctionDeclaration | MethodDeclaration | MethodSignature): TshParameter[]
  • Parse method parameters.

    export

    Parameters

    • node: FunctionDeclaration | MethodDeclaration | MethodSignature

    Returns TshParameter[]

parseModule

  • Parse a module to its declaration. Create a new namespace or module declaration and return it to be used as the new "container".

    export

    Parameters

    • resource: Resource
    • node: ModuleDeclaration

    Returns Resource

parseTypeAlias

  • parseTypeAlias(resource: Resource, node: TypeAliasDeclaration): void

parseVariable

specifierSort

stringTemplate

  • stringTemplate(strings: TemplateStringsArray, ...keys: number[]): function
  • Creates a template from an expression string. The template can then be used to infuse stuff into the template.

    export

    Parameters

    • strings: TemplateStringsArray
    • Rest ...keys: number[]

    Returns function

      • (...values: any[]): string
      • Parameters

        • Rest ...values: any[]

        Returns string

toPosix

  • toPosix(path: string): string
  • On Windows, replaces all backslash delimeters with forward slashes. On other OSes, returns the path unmodified.

    Parameters

    • path: string

    Returns string

traverseAst

  • traverseAst(root: Node, visit: function, skipContents?: undefined | function): void
  • Parameters

    • root: Node
    • visit: function
        • (node: Node): void
        • Parameters

          • node: Node

          Returns void

    • Optional skipContents: undefined | function

    Returns void

Object literals

Const GENERATORS

GENERATORS: object

Hash with all possible (yet implemented) generators.

__computed

__computed: generateAccessorDeclaration = generateAccessorDeclaration

Generated using TypeDoc