Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Wrong type on getServerSideProps query #19481

Closed
awareness481 opened this issue Nov 24, 2020 · 1 comment · Fixed by #20327
Closed

[Docs] Wrong type on getServerSideProps query #19481

awareness481 opened this issue Nov 24, 2020 · 1 comment · Fixed by #20327
Milestone

Comments

@awareness481
Copy link
Contributor

awareness481 commented Nov 24, 2020

Bug report

Describe the bug

On the next docs for getServerSideProps the query key from context is defined as of type string. As far as I can tell this is incorrect, based on this definition the correct type definition seems to be

[key: string]: string | string[] | undefined;

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create a new Next.js app npx create-next-app .
  2. Create a new page with getServerSideProps and log context.query
  3. Visit the page you created with query params ex: localhost:3000/page?test=hello
  4. Observe that context.query is an object and not a string

Expected behavior

Docs to have the correct type

Screenshots

If applicable, add screenshots to help explain your problem.

System information (not applicable)

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of Next.js: [e.g. 10.0.1]
  • Version of Node.js: [e.g. 12.0.0]
  • Deployment: [e.g. next start, next export, Vercel, other platform]

Additional context

I'm new to TS so I hope I haven't missed something obvious

@awareness481 awareness481 added the bug Issue was opened via the bug report template. label Nov 24, 2020
@Timer Timer added kind: bug and removed bug Issue was opened via the bug report template. labels Jan 4, 2021
@kodiakhq kodiakhq bot closed this as completed in #20327 Jan 4, 2021
kodiakhq bot pushed a commit that referenced this issue Jan 4, 2021
Closes #19481

The current text implies `query` is a string. IMO it would be better if it clarified that `query` is an object containing the query string's keys and values

Edit:
Relevant docs url: https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering
@Timer Timer added this to the iteration 15 milestone Jan 4, 2021
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants