Skip to content

controller

@tsed/di

Usage

typescript
import { controller } from "@tsed/di";

See /packages/di/src/types/common/fn/injectable.ts.

Overview

ts
const controller: <Token extends import("../index.js").TokenProvider>(token: Token, options?: Partial<import("../index.js").ProviderOpts<import("@tsed/core").Type<any>>>) => {
    alias: (value: string) => any & {
        inspect(): ControllerProvider<any>;
        store(): import("@tsed/core").Store;
        token(): Token;
        factory(f: (...args: unknown[]) => unknown): any & any;
        asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
        value(v: unknown): any & any;
        class(c: import("@tsed/core").Type<any>): any & any;
    };
    deps: (value: import("../index.js").TokenProvider[]) => any & {
        inspect(): ControllerProvider<any>;
        store(): import("@tsed/core").Store;
        token(): Token;
        factory(f: (...args: unknown[]) => unknown): any & any;
        asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
        value(v: unknown): any & any;
        class(c: import("@tsed/core").Type<any>): any & any;
    };
    scope: (value: import("../index.js").ProviderScope) => any & {
        inspect(): ControllerProvider<any>;
        store(): import("@tsed/core").Store;
        token(): Token;
        factory(f: (...args: unknown[]) => unknown): any & any;
        asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
        value(v: unknown): any & any;
        class(c: import("@tsed/core").Type<any>): any & any;
    };
    hooks: (value: Record<string, import("../domain/Provider.js").ProviderHookCallback<any>>) => any & {
        inspect(): ControllerProvider<any>;
        store(): import("@tsed/core").Store;
        token(): Token;
        factory(f: (...args: unknown[]) => unknown): any & any;
        asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
        value(v: unknown): any & any;
        class(c: import("@tsed/core").Type<any>): any & any;
    };
    imports: (value: (import("../index.js").TokenProvider | [import("../index.js").TokenProvider])[]) => any & {
        inspect(): ControllerProvider<any>;
        store(): import("@tsed/core").Store;
        token(): Token;
        factory(f: (...args: unknown[]) => unknown): any & any;
        asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
        value(v: unknown): any & any;
        class(c: import("@tsed/core").Type<any>): any & any;
    };
    priority: (value: number) => any & {
        inspect(): ControllerProvider<any>;
        store(): import("@tsed/core").Store;
        token(): Token;
        factory(f: (...args: unknown[]) => unknown): any & any;
        asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
        value(v: unknown): any & any;
        class(c: import("@tsed/core").Type<any>): any & any;
    };
    path: (value: string) => any & {
        inspect(): ControllerProvider<any>;
        store(): import("@tsed/core").Store;
        token(): Token;
        factory(f: (...args: unknown[]) => unknown): any & any;
        asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
        value(v: unknown): any & any;
        class(c: import("@tsed/core").Type<any>): any & any;
    };
    configuration: (value: Partial<TsED.Configuration>) => any & {
        inspect(): ControllerProvider<any>;
        store(): import("@tsed/core").Store;
        token(): Token;
        factory(f: (...args: unknown[]) => unknown): any & any;
        asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
        value(v: unknown): any & any;
        class(c: import("@tsed/core").Type<any>): any & any;
    };
    children: (value: import("../index.js").TokenProvider[]) => any & {
        inspect(): ControllerProvider<any>;
        store(): import("@tsed/core").Store;
        token(): Token;
        factory(f: (...args: unknown[]) => unknown): any & any;
        asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
        value(v: unknown): any & any;
        class(c: import("@tsed/core").Type<any>): any & any;
    };
    middlewares: (value: Partial<import("../domain/ControllerProvider.js").ControllerMiddlewares>) => any & {
        inspect(): ControllerProvider<any>;
        store(): import("@tsed/core").Store;
        token(): Token;
        factory(f: (...args: unknown[]) => unknown): any & any;
        asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
        value(v: unknown): any & any;
        class(c: import("@tsed/core").Type<any>): any & any;
    };
} & {
    inspect(): ControllerProvider<any>;
    store(): import("@tsed/core").Store;
    token(): Token;
    factory(f: (...args: unknown[]) => unknown): {
        alias: (value: string) => any & any;
        deps: (value: import("../index.js").TokenProvider[]) => any & any;
        scope: (value: import("../index.js").ProviderScope) => any & any;
        hooks: (value: Record<string, import("../domain/Provider.js").ProviderHookCallback<any>>) => any & any;
        imports: (value: (import("../index.js").TokenProvider | [import("../index.js").TokenProvider])[]) => any & any;
        priority: (value: number) => any & any;
        path: (value: string) => any & any;
        configuration: (value: Partial<TsED.Configuration>) => any & any;
        children: (value: import("../index.js").TokenProvider[]) => any & any;
        middlewares: (value: Partial<import("../domain/ControllerProvider.js").ControllerMiddlewares>) => any & any;
    } & any;
    asyncFactory(f: (...args: unknown[]) => Promise<unknown>): {
        alias: (value: string) => any & any;
        deps: (value: import("../index.js").TokenProvider[]) => any & any;
        scope: (value: import("../index.js").ProviderScope) => any & any;
        hooks: (value: Record<string, import("../domain/Provider.js").ProviderHookCallback<any>>) => any & any;
        imports: (value: (import("../index.js").TokenProvider | [import("../index.js").TokenProvider])[]) => any & any;
        priority: (value: number) => any & any;
        path: (value: string) => any & any;
        configuration: (value: Partial<TsED.Configuration>) => any & any;
        children: (value: import("../index.js").TokenProvider[]) => any & any;
        middlewares: (value: Partial<import("../domain/ControllerProvider.js").ControllerMiddlewares>) => any & any;
    } & any;
    value(v: unknown): {
        alias: (value: string) => any & any;
        deps: (value: import("../index.js").TokenProvider[]) => any & any;
        scope: (value: import("../index.js").ProviderScope) => any & any;
        hooks: (value: Record<string, import("../domain/Provider.js").ProviderHookCallback<any>>) => any & any;
        imports: (value: (import("../index.js").TokenProvider | [import("../index.js").TokenProvider])[]) => any & any;
        priority: (value: number) => any & any;
        path: (value: string) => any & any;
        configuration: (value: Partial<TsED.Configuration>) => any & any;
        children: (value: import("../index.js").TokenProvider[]) => any & any;
        middlewares: (value: Partial<import("../domain/ControllerProvider.js").ControllerMiddlewares>) => any & any;
    } & any;
    class(c: import("@tsed/core").Type<any>): {
        alias: (value: string) => any & any;
        deps: (value: import("../index.js").TokenProvider[]) => any & any;
        scope: (value: import("../index.js").ProviderScope) => any & any;
        hooks: (value: Record<string, import("../domain/Provider.js").ProviderHookCallback<any>>) => any & any;
        imports: (value: (import("../index.js").TokenProvider | [import("../index.js").TokenProvider])[]) => any & any;
        priority: (value: number) => any & any;
        path: (value: string) => any & any;
        configuration: (value: Partial<TsED.Configuration>) => any & any;
        children: (value: import("../index.js").TokenProvider[]) => any & any;
        middlewares: (value: Partial<import("../domain/ControllerProvider.js").ControllerMiddlewares>) => any & any;
    } & any;
};

alias:

ts
alias: (value: string) => any & {
     inspect(): ControllerProvider<any>;
     store(): import("@tsed/core").Store;
     token(): Token;
     factory(f: (...args: unknown[]) => unknown): any & any;
     asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
     value(v: unknown): any & any;
     class(c: import("@tsed/core").Type<any>): any & any;
 };

deps:

ts
deps: (value: import("../index.js").TokenProvider[]) => any & {
     inspect(): ControllerProvider<any>;
     store(): import("@tsed/core").Store;
     token(): Token;
     factory(f: (...args: unknown[]) => unknown): any & any;
     asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
     value(v: unknown): any & any;
     class(c: import("@tsed/core").Type<any>): any & any;
 };

scope:

ts
scope: (value: import("../index.js").ProviderScope) => any & {
     inspect(): ControllerProvider<any>;
     store(): import("@tsed/core").Store;
     token(): Token;
     factory(f: (...args: unknown[]) => unknown): any & any;
     asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
     value(v: unknown): any & any;
     class(c: import("@tsed/core").Type<any>): any & any;
 };

hooks:

ts
hooks: (value: Record<string, import("../domain/Provider.js").ProviderHookCallback<any>>) => any & {
     inspect(): ControllerProvider<any>;
     store(): import("@tsed/core").Store;
     token(): Token;
     factory(f: (...args: unknown[]) => unknown): any & any;
     asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
     value(v: unknown): any & any;
     class(c: import("@tsed/core").Type<any>): any & any;
 };

imports:

ts
imports: (value: (import("../index.js").TokenProvider | [import("../index.js").TokenProvider])[]) => any & {
     inspect(): ControllerProvider<any>;
     store(): import("@tsed/core").Store;
     token(): Token;
     factory(f: (...args: unknown[]) => unknown): any & any;
     asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
     value(v: unknown): any & any;
     class(c: import("@tsed/core").Type<any>): any & any;
 };

priority:

ts
priority: (value: number) => any & {
     inspect(): ControllerProvider<any>;
     store(): import("@tsed/core").Store;
     token(): Token;
     factory(f: (...args: unknown[]) => unknown): any & any;
     asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
     value(v: unknown): any & any;
     class(c: import("@tsed/core").Type<any>): any & any;
 };

path:

ts
path: (value: string) => any & {
     inspect(): ControllerProvider<any>;
     store(): import("@tsed/core").Store;
     token(): Token;
     factory(f: (...args: unknown[]) => unknown): any & any;
     asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
     value(v: unknown): any & any;
     class(c: import("@tsed/core").Type<any>): any & any;
 };

configuration:

ts
configuration: (value: Partial<TsED.Configuration>) => any & {
     inspect(): ControllerProvider<any>;
     store(): import("@tsed/core").Store;
     token(): Token;
     factory(f: (...args: unknown[]) => unknown): any & any;
     asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
     value(v: unknown): any & any;
     class(c: import("@tsed/core").Type<any>): any & any;
 };

children:

ts
children: (value: import("../index.js").TokenProvider[]) => any & {
     inspect(): ControllerProvider<any>;
     store(): import("@tsed/core").Store;
     token(): Token;
     factory(f: (...args: unknown[]) => unknown): any & any;
     asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
     value(v: unknown): any & any;
     class(c: import("@tsed/core").Type<any>): any & any;
 };

middlewares:

ts
middlewares: (value: Partial<import("../domain/ControllerProvider.js").ControllerMiddlewares>) => any & {
     inspect(): ControllerProvider<any>;
     store(): import("@tsed/core").Store;
     token(): Token;
     factory(f: (...args: unknown[]) => unknown): any & any;
     asyncFactory(f: (...args: unknown[]) => Promise<unknown>): any & any;
     value(v: unknown): any & any;
     class(c: import("@tsed/core").Type<any>): any & any;
 };

ts
} & {

inspect

ts
inspect(): ControllerProvider<any>;

store

ts
store(): import("@tsed/core").Store;

token

ts
token(): Token;

factory

ts
factory(f: (...args: unknown[]) => unknown): {
     alias: (value: string) => any & any;
     deps: (value: import("../index.js").TokenProvider[]) => any & any;
     scope: (value: import("../index.js").ProviderScope) => any & any;
     hooks: (value: Record<string, import("../domain/Provider.js").ProviderHookCallback<any>>) => any & any;
     imports: (value: (import("../index.js").TokenProvider | [import("../index.js").TokenProvider])[]) => any & any;
     priority: (value: number) => any & any;
     path: (value: string) => any & any;
     configuration: (value: Partial<TsED.Configuration>) => any & any;
     children: (value: import("../index.js").TokenProvider[]) => any & any;
     middlewares: (value: Partial<import("../domain/ControllerProvider.js").ControllerMiddlewares>) => any & any;
 } & any;

asyncFactory

ts
asyncFactory(f: (...args: unknown[]) => Promise<unknown>): {
     alias: (value: string) => any & any;
     deps: (value: import("../index.js").TokenProvider[]) => any & any;
     scope: (value: import("../index.js").ProviderScope) => any & any;
     hooks: (value: Record<string, import("../domain/Provider.js").ProviderHookCallback<any>>) => any & any;
     imports: (value: (import("../index.js").TokenProvider | [import("../index.js").TokenProvider])[]) => any & any;
     priority: (value: number) => any & any;
     path: (value: string) => any & any;
     configuration: (value: Partial<TsED.Configuration>) => any & any;
     children: (value: import("../index.js").TokenProvider[]) => any & any;
     middlewares: (value: Partial<import("../domain/ControllerProvider.js").ControllerMiddlewares>) => any & any;
 } & any;

value

ts
value(v: unknown): {
     alias: (value: string) => any & any;
     deps: (value: import("../index.js").TokenProvider[]) => any & any;
     scope: (value: import("../index.js").ProviderScope) => any & any;
     hooks: (value: Record<string, import("../domain/Provider.js").ProviderHookCallback<any>>) => any & any;
     imports: (value: (import("../index.js").TokenProvider | [import("../index.js").TokenProvider])[]) => any & any;
     priority: (value: number) => any & any;
     path: (value: string) => any & any;
     configuration: (value: Partial<TsED.Configuration>) => any & any;
     children: (value: import("../index.js").TokenProvider[]) => any & any;
     middlewares: (value: Partial<import("../domain/ControllerProvider.js").ControllerMiddlewares>) => any & any;
 } & any;

class

ts
class(c: import("@tsed/core").Type<any>): {
     alias: (value: string) => any & any;
     deps: (value: import("../index.js").TokenProvider[]) => any & any;
     scope: (value: import("../index.js").ProviderScope) => any & any;
     hooks: (value: Record<string, import("../domain/Provider.js").ProviderHookCallback<any>>) => any & any;
     imports: (value: (import("../index.js").TokenProvider | [import("../index.js").TokenProvider])[]) => any & any;
     priority: (value: number) => any & any;
     path: (value: string) => any & any;
     configuration: (value: Partial<TsED.Configuration>) => any & any;
     children: (value: import("../index.js").TokenProvider[]) => any & any;
     middlewares: (value: Partial<import("../domain/ControllerProvider.js").ControllerMiddlewares>) => any & any;
 } & any;

Released under the MIT License.