Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NestJS 9: InjectKysley type error Argument of type 'undefined' is not assignable to parameter of type 'string | symbol'. #16

Open
jdpt0 opened this issue May 17, 2023 · 3 comments

Comments

@jdpt0
Copy link

jdpt0 commented May 17, 2023

When injecting the kysley module with InjectKysely in NestJS 9 there is a type error:

TS1239: Unable to resolve signature of parameter decorator when called as an expression.   Argument of type 'undefined' is not assignable to parameter of type 'string | symbol'.

This seems to be stemming from the fact that when the package is being published, it is being published with NestJS 8 as it's dependency, which results in the wrong typings for the decorator when using it in NestJS 9.

@abnaod
Copy link

abnaod commented May 21, 2023

You can try to inject the module directly instead of using the wrapper decorator InjectKysely.

import { KYSELY_MODULE_CONNECTION_TOKEN } from 'nestjs-kysely';
import { Inject, Injectable } from '@nestjs/common';

import { DB } from '../db/types';
@Injectable()
export class UsersService {
  constructor(@Inject(KYSELY_MODULE_CONNECTION_TOKEN) private readonly db: Kysely<DB>) {}
}

@johnsvanda
Copy link

johnsvanda commented Aug 19, 2023

Or add this "strictNullChecks": false to your tsconfig

@kazu728
Copy link
Owner

kazu728 commented Apr 20, 2024

Sorry for the late reply.
If you are still getting this issue and are having trouble with it, I would appreciate it if you could provide some reproducible code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants