inject
@tsed/di
Usage
typescript
import { inject } from "@tsed/di";
Overview
ts
function inject<T>(token: TokenProvider<T>, opts?: Partial<Pick<InvokeOptions, "useOpts" | "rebuild" | "locals">>): T;
- token (
TokenProvider<T>
): A token provider or token provider group
Description
Inject a provider to another provider.
Use this function to inject a custom provider on constructor parameter or property.
typescript
@Injectable()
export class MyService {
connection = inject(CONNECTION);
}