# Provider Class

Module
import { Provider } from "@tsed/di"
Source/packages/di/src/class/Provider.ts

# Overview

class Provider<T> implements IProvider<T> {
    root: boolean;
    type: ProviderType | any;
    injectable: boolean;
    instance: T;
    deps: TokenProvider[];
    imports: any[];
    useFactory: Function;
    useAsyncFactory: Function;
    useValue: any;
    protected _provide: TokenProvider;
    protected _useClass: Type<T>;
    protected _instance: T;
    [key: string]: any;
    constructor(token: TokenProvider);
    get token(): any;
    get provide(): TokenProvider;
    set provide(value: TokenProvider);
    get useClass(): Type<T>;
    set useClass(value: Type<T>);
    get className(): string;
    get name(): string;
    get store(): Store;
    get scope(): ProviderScope;
    set scope(scope: ProviderScope);
    get configuration(): Partial<IDIConfigurationOptions>;
    set configuration(configuration: Partial<IDIConfigurationOptions>);
    isAsync(): boolean;
    clone(): Provider<any>;
    toString(): string;
}

# Members

root: boolean

type: ProviderType | any

injectable: boolean

instance: T


imports: any[]

useFactory: Function

useAsyncFactory: Function

useValue: any

protected _provide: TokenProvider

protected _useClass: Type<T>

protected _instance: T

[key: string]: any

get token(): any

get provide(): TokenProvider

set provide(value: TokenProvider)

get useClass(): Type<T>

set useClass(value: Type<T>)

Create a new store if the given value is a class. Otherwise the value is ignored.


get className(): string

get name(): string

get store(): Store

get scope(): ProviderScope

Get the scope of the provider.

Note

Async provider is always a SINGLETON

:::


set scope(scope: ProviderScope)

Change the scope value of the provider.




isAsync(): boolean

clone(): Provider<any>

toString(): string