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

495
Vistas
Property 'slug' does not exist on type 'ParsedUrlQuery | undefined'

I am trying to get the path of my page on getServerSideProps, but the type of params is object

What I need to do to get as string?

export const getServerSideProps: GetServerSideProps = async (context) => {
  const { slug } = context.params // Property 'slug' does not exist on type 'ParsedUrlQuery | undefined'.ts(2339)

  return {
    props: {
    },
  }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you're looking for the path as a String, you can try context.req.url. (See the docs for the full list of context properties).

For the dynamic parameter, it depends on what you've named the page, for example if you have a Blog post page, with a pages/posts/[post].js file, the slug will be in context.params.post as opposed to context.params.slug.

Hope this is helpful!

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