/** * Builtin type registry — parses type annotation strings from builtin docs * into Type values, cached for lookup during inference. */ import type { BuiltinNormalExpressions, FunctionDocs } from '../builtin/interface'; import type { Type } from './types'; export interface BuiltinTypeInfo { /** The parsed function type. */ type: Type; /** If the function is a type guard, the parameter name being narrowed. */ guardParam?: string; /** If the function is a type guard, the type it narrows to. */ guardType?: Type; } /** * Initialize the builtin type cache from the builtin normal expressions. * Call once at startup before inference begins. */ export declare function initBuiltinTypes(normalExpressions: BuiltinNormalExpressions): void; /** * Look up the type of a builtin by name. * Returns Unknown if the builtin has no type annotation or wasn't parsed. */ export declare function getBuiltinType(name: string): BuiltinTypeInfo; /** * Check if a builtin is a type guard (e.g. isNumber narrows to Number). */ export declare function isTypeGuard(name: string): boolean; /** * Register a module's exports as a record type. * Called during initialization for each registered module. * * `functions` covers TS-implemented entries with inline `docs`. `docs` covers * source-implemented entries (where the `.dvala` source provides the impl and * the docs map provides the declared type) and overrides anything in * `functions` for the same name. Without the second argument, source-impl * module functions are invisible to the typechecker — `import("effectHandler")` * would yield a record with no `chooseRandom` etc. */ export declare function registerModuleType(moduleName: string, functions: BuiltinNormalExpressions, docs?: Record): void; /** * Look up a module's type (record of exports). * Returns Unknown if the module is not registered. */ export declare function getModuleType(moduleName: string): Type; /** * Reset registered module types. * Called between typecheck passes so each runner sees only its own modules. */ export declare function resetModuleTypeCache(): void; /** * Reset the cache (for testing). */ export declare function resetBuiltinTypeCache(): void;