# IProvider Interface
Module | import { IProvider } from "@tsed/di" |
---|---|
Source | /packages/di/src/interfaces/IProvider.ts |
# Overview
interface IProvider<T = any> {
/**
* An injection token. (Typically an instance of `Type` or `InjectionToken`, but can be `any`).
*/
provide: TokenProvider;
/**
* Provider type
*/
type?: ProviderType | string;
/**
* Instance build by the injector
*/
instance?: T;
/**
* Define dependencies to build the provider
*/
deps?: TokenProvider[];
/**
* Class to instantiate for the `token`.
*/
useClass?: Type<T>;
/**
* Provide a function to build the provider
*/
useFactory?: Function;
/**
* Provide an async function to build the provider
*/
useAsyncFactory?: Function;
/**
* Provide predefined value
*/
useValue?: any;
/**
* Scope used by the injector to build the provider.
*/
scope?: ProviderScope;
/**
* A list of resolvers which will be used to resolve missing Symbol/Class when injector invoke a Class. This property allow external DI usage.
*/
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?: ProviderScope;
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;
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Jest
- Seq
- Controllers
- Providers
- Model
- Converters
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing