node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

TS Build Error: TS5084: Tuple members must all have names or all not have names

Open joshowens-basis opened this issue 6 months ago • 2 comments

I got this error after trying to build my project with Redis as a dependency:

$ tsc
node_modules/@redis/client/dist/lib/commands/generic-transformers.d.ts:196:67 - error TS5084: Tuple members must all have names or all not have names.

196 type StreamMessagesRawReply = TuplesReply<[name: BlobStringReply, ArrayReply<StreamMessageRawReply>]>;
                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/@redis/client/dist/lib/commands/generic-transformers.d.ts:196

error Command failed with exit code 2.

From looking at the source code, it looks like the ArrayReply part of the tuple should have a name of messages? https://github.com/redis/node-redis/blob/6f3380ba68786a3d5a9825f9a29c2053e43d32e3/packages/client/lib/commands/generic-transformers.ts#L553

joshowens-basis avatar Jul 03 '25 23:07 joshowens-basis

Hey @joshowens-basis,

Thank you for reporting this issue. I've successfully reproduced it with node-redis 5.5.6 and typescript 4.9.5. As a temporary workaround, can you check if setting skipLibCheck: true in your tsconfig.json resolves the issue for you?

Since you've already identified where this issue occurs, would you be interested in submitting a PR to fix it?

PavelPashov avatar Jul 04 '25 07:07 PavelPashov

Isn't the solution to use/require TypeScript 5.2+ https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#named-and-anonymous-tuple-elements

infrahead avatar Oct 20 '25 14:10 infrahead