import ts from 'typescript';
import { Result } from '../../util/Result.cjs';
import { UserTranspileIntention } from '../../cli/args.cjs';

/**
 * For read the TypeScript code, and turn it into AST.
 */
declare class Analyser {
    static readonly default_compiler_option: ts.CompilerOptions;
    private static readonly default_compiler_host;
    static readonly virtual_file_name = "virtual_file__do_not_really_exist.ts";
    static readonly default_constructor_args: Analyser_Args;
    private program;
    constructor(args?: Analyser_Args);
    /**
     * The most important feature of `Analyser`.
     *
     * This function returns the configured `ts.Program` which handles all inputed files.
     */
    getCompilerProgram(): ts.Program;
    /**
     * Get the Abstract Syntax Tree (AST, with type `ts.SourceFile`) of a TypeScript file.
     *
     * @param path If relative, the `.` stands for the working directory when `tstosc` starts.
     *  Be careful that the file you want to get AST from, must be **in** the `root_files_path`,
     *   or **being referenced** by the files in the `root_files_path`.
     */
    getASTOfFile(file_path: string): ts.SourceFile | undefined;
    static buildASTFromCode(source_code: string): Result<ts.SourceFile, BuildASTFailError>;
    static preCheckErrorsBeforeBuildAST({ ts_source_file }: preCheckBeforeBuildAST_Params): TypeScriptError[];
    checkIfExistsUnsupportSyntax(): void;
    traverseTSNode(ts_node: ts.SourceFile | ts.Node, action: (n: ts.Node) => any): void;
}
type Analyser_Args = {
    root_files_path: string[];
} | {
    global: UserTranspileIntention["global"];
    files: UserTranspileIntention["files"];
};
type preCheckBeforeBuildAST_Params = {
    ts_source_file: ts.SourceFile;
};
declare enum BuildASTFailErrorType {
    input_is_not_valid_ts = "input_is_not_valid_ts",
    input_contains_unsupported_syntax = "input_contains_unsupported_syntax"
}
type BuildASTFailError = {
    error_type: BuildASTFailErrorType.input_is_not_valid_ts;
    details: TypeScriptError[];
} | {
    error_type: BuildASTFailErrorType.input_contains_unsupported_syntax;
};
type TypeScriptError = ({
    is_compiler_error: true;
} | {
    is_compiler_error: false;
    position_line: number;
    position_column: number;
}) & {
    message: string;
};
/**
 * Use default option to get an AST from source code.
 */
declare function getASTFromCode(source_code: string): Result<ts.SourceFile, BuildASTFailError>;

export { Analyser, BuildASTFailErrorType, getASTFromCode };
