Options
All
  • Public
  • Public/Protected
  • All
Menu

jsdoc-type-pratt-parser

Index

Type aliases

CatharsisMode

CatharsisMode: "jsdoc" | "closure"

CompareMode

CompareMode: ParseMode | "fail" | "differ"

JtpMode

JtpMode: "jsdoc" | "closure" | "typescript" | "permissive"

NodeVisitor

NodeVisitor: (node: NonRootResult, parentNode?: NonRootResult, property?: string) => void

Type declaration

    • A node visitor function.

      Parameters

      • node: NonRootResult

        the visited node.

      • Optional parentNode: NonRootResult

        the parent node.

      • Optional property: string

        the property on the parent node that contains the visited node. It can be the node itself or an array of nodes.

      Returns void

NonRootResult

A parse sub result that might not be a valid type expression on its own.

ParseMode

ParseMode: "closure" | "jsdoc" | "typescript"

QuoteStyle

QuoteStyle: "single" | "double"

RootResult

A parse result that corresponds to a valid type expression.

SpecialNamePathType

SpecialNamePathType: "module" | "event" | "external"

TransformFunction

TransformFunction<TransformResult>: (parseResult: NonRootResult) => TransformResult

Type parameters

  • TransformResult

Type declaration

TransformRule

TransformRule<TransformResult, InputType>: (parseResult: InputType, transform: TransformFunction<TransformResult>) => TransformResult

Type parameters

Type declaration

    • (parseResult: InputType, transform: TransformFunction<TransformResult>): TransformResult
    • Parameters

      Returns TransformResult

TransformRules

TransformRules<TransformResult>: { [ P in NonRootResult as P["type"]]: TransformRule<TransformResult, P> }

Type parameters

  • TransformResult

VisitorKeys

VisitorKeys: { [ P in NonRootResult as P["type"]]: keyof P[] }

Variables

visitorKeys

visitorKeys: VisitorKeys = ...

Functions

catharsisTransform

  • catharsisTransform(result: RootResult): CatharsisParseResult

identityTransformRules

jtpTransform

parse

stringify

stringifyRules

testFixture

  • testFixture(fixture: Fixture): void

transform

traverse

  • A function to traverse an AST. It traverses it depth first.

    Parameters

    • node: RootResult

      the node to start traversing at.

    • Optional onEnter: NodeVisitor

      node visitor function that will be called on entering the node. This corresponds to preorder traversing.

    • Optional onLeave: NodeVisitor

      node visitor function that will be called on leaving the node. This corresponds to postorder traversing.

    Returns void

tryParse

  • This function tries to parse the given expression in multiple modes and returns the first successful RootResult. By default it tries 'typescript', 'closure' and 'jsdoc' in this order. If no mode was successful it throws the error that was produced by the last parsing attempt.

    Parameters

    Returns RootResult

Generated using TypeDoc