mmkal / handy-redis

A wrapper around node_redis with Promise and TypeScript support.
Apache License 2.0
172 stars 10 forks source link

Multi Type definition issue #250

Closed grokasm closed 3 years ago

grokasm commented 3 years ago

My app currently uses Typescript version 3.8.2 and I'm encountering the following error when building with tsc

node_modules/handy-redis/dist/node_redis/multi.d.ts:3:50 - error TS1256: A rest element must be last in a tuple type.

3 declare type Push_ts4<A extends unknown[], B> = [...A, B];

The README states the multi command has a fallback for Typescript < 4, but it doesn't seem to build at all.

I'm not able to upgrade to ts > 4 at this time. Are there any known workarounds? Thanks!

mmkal commented 3 years ago

Thanks for the report @grokasm - I forgot that ts-ignore statements are stripped when generating declarations. If you manually add // @ts-ignore to the line above in node_modules/handy-redis/dist/node_redis/multi.d.ts, does the problem go away?

If that works, I can explicitly patch the d.ts file before publishing a new version (shouldn't take long, but you can use patch-package if you need to work right now). For the long term, I've asked about a better way to do this in the typescript issue above.

grokasm commented 3 years ago

Thanks @mmkal for the workaround, I have since moved to the redis module out of necessity. In the meantime we are upgrading to typescript > 4, so I will most likely return to this very useful redis library.