Skip to content

InjectDrizzle should InjectionToken<T> not a string #27

@stalniy

Description

@stalniy

Why

InjectionToken<T> is a way to make string/symbol based injection to be typesafe. So, instead of making:

export const DRIZZLE_TOKEN = 'DRIZZLE'

I want to do this:

import type { InjectionToken } from "@nestjs/common";
import type { NodePgDatabase } from "drizzle-orm/node-postgres";

export const DRIZZLE_PROVIDER_TOKEN: InjectionToken<NodePgDatabase<any>> = "DRIZZLE";

So, then if I inject this token with module.get(DRIZZLE_PROVIDER_TOKEN) I get at least somewhat proper interface and not just any

What

Currently InjectDrizzle(tag: string) accepts only string, the same as DrizzlePGModule.registerAsync. Both must accept typesafe InjectionToken

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions