/** * Context creation and manipulation functions */ import { EmitterOptions, EmitterContext } from "./core.js"; export declare const contextSurfaceIncludesJs: (context: Pick) => boolean; /** * Create a new emitter context with default values */ export declare const createContext: (options: EmitterOptions) => EmitterContext; /** * Increase indentation level */ export declare const indent: (context: EmitterContext) => EmitterContext; /** * Decrease indentation level */ export declare const dedent: (context: EmitterContext) => EmitterContext; /** * Set static context flag */ export declare const withStatic: (context: EmitterContext, isStatic: boolean) => EmitterContext; /** * Set async context flag */ export declare const withAsync: (context: EmitterContext, isAsync: boolean) => EmitterContext; /** * Set current class name in context */ export declare const withClassName: (context: EmitterContext, className: string) => EmitterContext; /** * Scoped fields that should be restored after emission. * These fields define lexical scopes and should not leak to parent scopes. */ type ScopedFields = Pick; /** * Execute an emission function with scoped context fields. * * This helper ensures that scoped fields (typeParameters, returnType, * local lexical maps, and flow narrowings) are * restored after emission, preventing scope leaks when context is threaded * upward via [result, newContext] tuples. * * Other context mutations (intLoopVars, importBindings, etc.) are preserved * and bubbled up correctly. * * @example * ```typescript * const [result, finalCtx] = withScoped( * context, * { * typeParameters: new Set([...context.typeParameters ?? [], "T"]), * returnType: stmt.returnType * }, * (scopedCtx) => emitFunctionBody(stmt.body, scopedCtx) * ); * ``` */ export declare const withScoped: (context: EmitterContext, scopedPatch: Partial, emit: (ctx: EmitterContext) => [T, EmitterContext]) => [T, EmitterContext]; export {}; //# sourceMappingURL=context.d.ts.map