/** * Dependency Injection Container * * A simple, TypeScript-native DI container that: * - Supports singleton and factory registrations * - Provides type-safe dependency resolution * - Enables easy testing through dependency injection */ /** * Factory function type for creating service instances */ type Factory = (container: ServiceContainer) => T; /** * Service Container for Dependency Injection */ export declare class ServiceContainer { private registrations; /** * Register a factory that creates a new instance each time */ register(token: symbol, factory: Factory): void; /** * Register a singleton - only created once */ registerSingleton(token: symbol, instanceOrFactory: T | Factory): void; /** * Register a value directly */ registerValue(token: symbol, value: T): void; /** * Resolve a service by its token */ get(token: symbol): T; /** * Check if a token is registered */ has(token: symbol): boolean; /** * Get all registered tokens */ getTokens(): symbol[]; /** * Clear all registrations (useful for testing) */ clear(): void; /** * Create a child container that inherits parent registrations */ createChild(): ServiceContainer; } /** * Get the global container instance */ export declare function getContainer(): ServiceContainer; /** * Set the global container instance (useful for testing) */ export declare function setContainer(container: ServiceContainer): void; /** * Reset the global container (useful for testing) */ export declare function resetContainer(): void; export {}; //# sourceMappingURL=Container.d.ts.map