/** * Token utilities for dependency injection. * * These utilities help with token resolution, type checking, and * dependency discovery from class metadata. */ import type { Token, Type } from '../interfaces/base.interface.js'; /** * Get a human-readable name for a token. * * @param t - The token to get the name for * @returns A string representation of the token */ export declare const tokenName: (t: Token) => string; /** * Check if a value is a class constructor. * * @param x - The value to check * @returns True if x is a class constructor */ export declare const isClass: (x: any) => x is Type; /** * Check if a value is a Promise. * * @param v - The value to check * @returns True if v is a Promise */ export declare const isPromise: (v: any) => v is Promise; /** * Get async-with dependency tokens from a class. * * If a class is decorated with @AsyncWith, this returns the token array * that should be resolved and passed to the static `with()` method. * * @param klass - The class to get tokens from * @returns Array of dependency tokens, or null if not decorated */ export declare function getAsyncWithTokens(klass: Type): Type[] | null; /** * Read parameter types for static with(...) method. * * This function is TDZ-friendly and will use the @AsyncWith token array * if available, falling back to design:paramtypes metadata. * * @param klass - The class to read parameter types from * @param forWhat - Whether this is for 'discovery' or 'invocation' phase * @returns Array of dependency types * @throws If parameter types cannot be determined */ export declare function readWithParamTypes(klass: Type, forWhat: 'discovery' | 'invocation'): Type[]; /** * Discover dependencies for a CLASS token or concrete Type. * * For classes with @AsyncWith, reads from the static `with()` method. * Otherwise, reads constructor parameter types. * * @param klass - The class to discover dependencies for * @param phase - Whether this is 'discovery' or 'invocation' phase * @returns Array of dependency types * @throws If dependencies cannot be determined (TDZ issues, missing metadata) */ export declare function depsOfClass(klass: Type, phase: 'discovery' | 'invocation'): Type[]; /** * Discover dependencies for a function token. * * Reads design:paramtypes metadata, skipping the first parameter * (which is typically the input argument, not a dependency). * * @param fn - The function to discover dependencies for * @param phase - Whether this is 'discovery' or 'invocation' phase * @returns Array of dependency types * @throws If dependencies cannot be determined */ export declare function depsOfFunc(fn: (...args: any[]) => any | Promise, phase: 'discovery' | 'invocation'): Type[];