Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

358
Vistas
When does the Express req.query variable get different types

I noticed that the type of query parameters in req.query is

string | string[] | QueryString.ParsedQS | QueryString.ParsedQS[]

but so far, whenever i used req.query i always got strings.

My questions are

  1. What is the QueryString.ParsedQS type?
  2. When will the parameter be an array?
  3. When will the parameter be a QueryString.ParsedQS
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The type string | string[] | QueryString.ParsedQS | QueryString.ParsedQS[] is the type returned by qs.parse() method, take a look here at the declaration file: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/qs/index.d.ts#L57.

Take a look at the qs documentation for possible return values of qs.parse():
https://github.com/ljharb/qs

For req.query to be parsed from string to object you need to call express app.set('query parser', 'extended'), extended is the default value but you may have changed it in your code:
https://expressjs.com/en/api.html#app.set

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda