nest-modules / ioredis

:see_no_evil: :hear_no_evil: :speak_no_evil: A ioredis module for Nest framework (node.js)
MIT License
145 stars 31 forks source link

Wrong type def on `getRedisConnectionToken` and `getRedisOptionsToken` parameter #257

Closed micalevisk closed 2 years ago

micalevisk commented 2 years ago

Here:

https://github.com/nest-modules/ioredis/blob/155a77249a95bcee84b8e87ea101e8588d4e93cb/lib/redis.decorators.ts#L4

connection is optional, thus connection could be undefined.

But here:

https://github.com/nest-modules/ioredis/blob/155a77249a95bcee84b8e87ea101e8588d4e93cb/lib/redis.utils.ts#L13

and here:

https://github.com/nest-modules/ioredis/blob/155a77249a95bcee84b8e87ea101e8588d4e93cb/lib/redis.utils.ts#L9

it's not

Thus, although we can use @InjectRedis(), we can't call getRedisConnectionToken() (when "strictNullChecks": true)

juandav commented 2 years ago

DONE