Stratal API Reference
    Preparing search index...

    Interface ExistingProvider<T>

    Provider that creates an alias to an existing token

    When the provide token is resolved, the container resolves useExisting instead. Both tokens return the same instance (for singleton/request-scoped services).

    Use cases:

    • Creating interface tokens that alias concrete implementations
    • Multiple tokens resolving to the same service
    {
    provide: 'IUserService',
    useExisting: UserService
    }
    // Resolving 'IUserService' returns the UserService instance
    providers: [
    UserService,
    { provide: I_USER_SERVICE, useExisting: UserService }
    ]
    // Both UserService and I_USER_SERVICE resolve to the same instance
    interface ExistingProvider<T extends object = object> {
        provide: InjectionToken<T>;
        useExisting: InjectionToken<T>;
    }

    Type Parameters

    • T extends object = object
    Index

    Properties

    Properties

    provide: InjectionToken<T>
    useExisting: InjectionToken<T>