0

I have this Next.js method:

export const getServerSideProps: GetServerSideProps = async context => {

  const {query, locale, req} = context
  ...
}

Is there a way I can cast my own specific type to only the query parameter while deconstructing like so? Because by default each property in query...

const {prop1, prop2, prop3} = query

...has a default type of string | string[] which is somewhat too much to handle/override in code.

artooras
  • 6,315
  • 9
  • 45
  • 78

0 Answers0