/** * Helper type to represent any callable that can be used as a dependency source * This accepts: * - Concrete classes (new (...args) => T) * - Abstract classes (abstract new (...args) => T) * - Plain functions ((...args) => T) */ export type Callable = (new (...args: any[]) => T) | (abstract new (...args: any[]) => T) | ((...args: any[]) => T); export interface Tagged { _type: TAG; } /** * Primitive type constructors */ export type PrimitiveType = typeof String | typeof Number | typeof Boolean | typeof Symbol | typeof BigInt; /** * TypeTag - An ADT representing a type identifier for dependency injection * * Can be one of: * - CallableTag: A class, abstract class, or function * - PrimitiveTag: A JavaScript primitive type (String, Number, Boolean, Symbol, BigInt) * - TokenTag: A Symbol instance used to represent an interface * - SetTag: A set of elements of a given type */ export type TypeTag = { kind: 'tagged'; value: Tagged; } | { kind: 'callable'; value: Callable; } | { kind: 'primitive'; value: PrimitiveType; name: string; } | { kind: 'token'; value: symbol; description: string; } | { kind: 'set'; elementTag: TypeTag; }; /** * Helper functions to create TypeTags */ export declare const TypeTag: { /** * Create a TypeTag from a callable (class or function) */ callable(callable: Callable): TypeTag; tagged(tagged: Tagged): TypeTag; /** * Create a TypeTag from a symbol token (for representing interfaces) */ token(token: symbol): TypeTag; /** * Create a TypeTag for String type */ string(): TypeTag; /** * Create a TypeTag for Number type */ number(): TypeTag; /** * Create a TypeTag for Boolean type */ boolean(): TypeTag; /** * Create a TypeTag for Symbol type */ symbol(): TypeTag; /** * Create a TypeTag for BigInt type */ bigint(): TypeTag; /** * Get a string representation of a TypeTag */ toString(tag: TypeTag): string; /** * Create a TypeTag for a set of elements */ set(elementTag: TypeTag): TypeTag>; }; /** * Unique identifier for a dependency in the dependency injection graph. * Can identify types by constructor, named bindings using @Id, or set bindings. */ export declare class DIKey { readonly type: TypeTag; readonly id?: string | undefined; private readonly _brand; constructor(type: TypeTag, id?: string | undefined); /** * Create a DIKey for a type */ static of(type: Callable): DIKey; /** * Create a named DIKey (for @Id bindings) */ static named(type: Callable, id: string): DIKey; /** * Create a DIKey for a symbol token (for interface bindings) */ static token(token: symbol): DIKey; /** * Create a named DIKey for a symbol token */ static namedToken(token: symbol, id: string): DIKey; /** * Create a DIKey for a set binding */ static set(type: Callable): DIKey>; /** * Create a DIKey for a named set binding */ static namedSet(type: Callable, id: string): DIKey>; /** * Create a DIKey for a set binding using a symbol token */ static setToken(token: symbol): DIKey>; /** * Create a DIKey for a named set binding using a symbol token */ static namedSetToken(token: symbol, id: string): DIKey>; /** * Get the raw callable from this key (for callable types) * Returns undefined for primitive types */ getCallable(): Callable | undefined; /** * Check if this key matches another key */ equals(other: DIKey): boolean; /** * Deep equality check for TypeTags */ private typeTagEquals; /** * Get a string representation of this key for debugging and error messages */ toString(): string; /** * Get a hashable key for use in Maps */ toMapKey(): string; } /** * Metadata key for storing @Id annotations */ export declare const ID_METADATA_KEY: unique symbol; /** * Store for named parameter annotations */ export declare const PARAM_IDS_METADATA_KEY: unique symbol; //# sourceMappingURL=DIKey.d.ts.map