import { ErrorType } from 'inkjs/engine/Error';

type CompileSharedType = {
    labelToRemove: string[];
    initialVarsToRemove: string[];
    functions: {
        name: string;
        args: number;
    }[];
    enums: {
        [key: string]: Record<string, number>;
    };
    textSource: string;
};
type IssueType = {
    message: string;
    type: ErrorType;
    line: number;
};

declare namespace InkCompiler {
    function compile(text: string, shared?: Omit<CompileSharedType, "textSource">): {
        json: string;
        issues: IssueType[];
    } | {
        issues: IssueType[];
        json?: undefined;
    };
    function getErrors(issues: IssueType[], recompile: () => void, shared: CompileSharedType): void | {
        issues: IssueType[];
    };
}

export { InkCompiler };
