# Provider Class

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

# Overview

class Provider<T = any> implements IProvider<T> {
    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;
<span class="token punctuation">[</span>key<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">]</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>
<span class="token keyword">constructor</span><span class="token punctuation">(</span>token<span class="token punctuation">:</span> <a href="/api/di/interfaces/TokenProvider.html"><span class="token">TokenProvider</span></a><span class="token punctuation">)</span><span class="token punctuation">;</span>
get <span class="token function">token</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>
get <span class="token function">provide</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/di/interfaces/TokenProvider.html"><span class="token">TokenProvider</span></a><span class="token punctuation">;</span>
set <span class="token function">provide</span><span class="token punctuation">(</span>value<span class="token punctuation">:</span> <a href="/api/di/interfaces/TokenProvider.html"><span class="token">TokenProvider</span></a><span class="token punctuation">)</span><span class="token punctuation">;</span>
get <span class="token function">useClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;T&gt;<span class="token punctuation">;</span>
/**
 * Create a new store if the given value is a <span class="token keyword">class</span>. Otherwise the value is ignored.
 * @param value
 */
set <span class="token function">useClass</span><span class="token punctuation">(</span>value<span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;T&gt;<span class="token punctuation">)</span><span class="token punctuation">;</span>
get <span class="token function">className</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>
get <span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>
get <span class="token function">store</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/core/class/Store.html"><span class="token">Store</span></a><span class="token punctuation">;</span>
/**
 * <a href="/api/common/mvc/decorators/method/Get.html"><span class="token">Get</span></a> the scope of the provider.
 *
 * <span class="token punctuation">:</span><span class="token punctuation">:</span><span class="token punctuation">:</span> tip Note
 * Async provider is always a SINGLETON
 * <span class="token punctuation">:</span><span class="token punctuation">:</span><span class="token punctuation">:</span>
 *
 * @returns <span class="token punctuation">{</span><span class="token keyword">boolean</span><span class="token punctuation">}</span>
 */
get <span class="token function">scope</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/di/interfaces/ProviderScope.html"><span class="token">ProviderScope</span></a><span class="token punctuation">;</span>
/**
 * Change the scope value of the provider.
 * @param scope
 */
set <span class="token function">scope</span><span class="token punctuation">(</span>scope<span class="token punctuation">:</span> <a href="/api/di/interfaces/ProviderScope.html"><span class="token">ProviderScope</span></a><span class="token punctuation">)</span><span class="token punctuation">;</span>
get <span class="token function">configuration</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Partial&lt;TsED.<a href="/api/di/decorators/Configuration.html"><span class="token">Configuration</span></a>&gt;<span class="token punctuation">;</span>
set <span class="token function">configuration</span><span class="token punctuation">(</span>configuration<span class="token punctuation">:</span> Partial&lt;TsED.<a href="/api/di/decorators/Configuration.html"><span class="token">Configuration</span></a>&gt;<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">get</span><span class="token punctuation">(</span>key<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>
<span class="token function">isAsync</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>
<span class="token function">clone</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Provider&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>
<span class="token function">toString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>

}