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

The DocumentContext.defaultGetInitialProps type is missing the optional options argument #36247

Closed
1 task done
seanparmelee opened this issue Apr 18, 2022 · 1 comment · Fixed by #36252
Closed
1 task done
Labels
bug Issue was opened via the bug report template.

Comments

@seanparmelee
Copy link
Contributor

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

    Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 21.4.0: Mon Feb 21 20:36:53 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T8101
    Binaries:
      Node: 16.14.2
      npm: 8.5.0
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 12.1.6-canary.3
      react: 17.0.2
      react-dom: 17.0.2

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

The type definition for DocumentContext.defaultGetInitialProps is missing the optional options argument so a Type error: Expected 1 arguments, but got 2. error appears if you try to do something like

const docProps = await ctx.defaultGetInitialProps(ctx, { nonce });

as demonstrated in the styled-jsx-with-csp example.

Expected Behavior

There should not be a TypeScript error when passing in an options object to defaultGetInitialProps.

To Reproduce

  1. Checkout https://github.com/seanparmelee/nextjs-documentcontext-issue
  2. From the project folder, run npm install and then npm run build
@seanparmelee seanparmelee added the bug Issue was opened via the bug report template. label Apr 18, 2022
@kodiakhq kodiakhq bot closed this as completed in #36252 Apr 19, 2022
kodiakhq bot pushed a commit that referenced this issue Apr 19, 2022
## Bug

- [X] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

This PR fixes #36247 by adding the optional `options` object to the type definition for `DocumentContext.defaultGetInitialProps`.
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant