# IProvider Interface

Module
import { IProvider } from "@tsed/di"
Source/packages/di/src/interfaces/IProvider.ts

# Overview

interface IProvider<T> {
    provide: TokenProvider;
    type?: ProviderType | string;
    instance?: T;
    deps?: TokenProvider[];
    useClass?: Type<T>;
    useFactory?: Function;
    useAsyncFactory?: Function;
    useValue?: any;
    scope?: ProviderScope;
    resolvers?: IDIResolver[];
    [key: string]: any;
}

# Members

provide: TokenProvider

An injection token. (Typically an instance of Type or InjectionToken, but can be any).


type?: ProviderType | string

Provider type


instance?: T

Instance build by the injector


deps?: TokenProvider[]

Define dependencies to build the provider


useClass?: Type<T>

Class to instantiate for the token.


useFactory?: Function

Provide a function to build the provider


useAsyncFactory?: Function

Provide an async function to build the provider


useValue?: any

Provide predefined value


Scope used by the injector to build the provider.


resolvers?: IDIResolver[]

A list of resolvers which will be used to resolve missing Symbol/Class when injector invoke a Class. This property allow external DI usage.


[key: string]: any