KC's Workspace
    Preparing search index...
    interface ParserOptions {
        astType?: "js" | "ts";
        lang?: "dts" | "js" | "jsx" | "ts" | "tsx";
        preserveParens?: boolean;
        range?: boolean;
        showSemanticErrors?: boolean;
        sourceType?: "module" | "script" | "unambiguous";
    }
    Index

    Properties

    astType?: "js" | "ts"

    Return an AST which includes TypeScript-related properties, or excludes them.

    'js' is default for JS / JSX files. 'ts' is default for TS / TSX files. The type of the file is determined from lang option, or extension of provided filename.

    lang?: "dts" | "js" | "jsx" | "ts" | "tsx"

    Treat the source text as js, jsx, ts, tsx or dts.

    preserveParens?: boolean

    Emit ParenthesizedExpression and TSParenthesizedType in AST.

    If this option is true, parenthesized expressions are represented by (non-standard) ParenthesizedExpression and TSParenthesizedType nodes that have a single expression property containing the expression inside parentheses.

    true
    
    range?: boolean

    Controls whether the range property is included on AST nodes. The range property is a [number, number] which indicates the start/end offsets of the node in the file contents.

    false
    
    showSemanticErrors?: boolean

    Produce semantic errors with an additional AST pass. Semantic errors depend on symbols and scopes, where the parser does not construct. This adds a small performance overhead.

    false
    
    sourceType?: "module" | "script" | "unambiguous"

    Treat the source text as script or module code.