Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

254
Views
Redis: Agregar al conjunto ordenado usando TypeScript

Estoy tratando de agregar un valor a un conjunto ordenado en Redis usando TypeScript como este client.ZADD('test', 10, 'test') pero esto arroja un error

 Argument of type '["test", 10, "test"]' is not assignable to parameter of type '[key: string, members: ZMember | ZMember[], options?: ZAddOptions | undefined] | [options: CommandOptions<ClientCommandOptions>, key: string, members: ZMember | ZMember[], options?: ZAddOptions | undefined]'. Type '["test", 10, "test"]' is not assignable to type '[options: CommandOptions<ClientCommandOptions>, key: string, members: ZMember | ZMember[], options?: ZAddOptions | undefined]'. Type at position 0 in source is not compatible with type at position 0 in target. Type 'string' is not assignable to type 'CommandOptions<ClientCommandOptions>'. Type 'string' is not assignable to type '{ readonly [symbol]: true; }'.
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

En los archivos de definiciones de tipos redis que se encuentran en:

 node_modules\@node-redis\client\dist\lib\commands\generic-transformers.d.ts

La definición de interfaz para el tipo ZMember es la siguiente:

 interface ZMember { score: number; value: string; }

Por lo tanto, su llamada a la función debería tener el siguiente aspecto:

 client.zAdd('test_list', { score: 10, value: 'test'})
about 4 years ago · Juan Pablo Isaza Report

0

client.ZADD('test', { member: 'test', score: 10 }) debería ser el truco

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!