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

Add JSX.Element to styles type in DocumentInitialProps #36392

Merged
merged 3 commits into from
May 23, 2022
Merged

Add JSX.Element to styles type in DocumentInitialProps #36392

merged 3 commits into from
May 23, 2022

Conversation

dawsonbooth
Copy link
Contributor

@dawsonbooth dawsonbooth commented Apr 22, 2022

Description

Using next.js with React 18 types and styled-components currently results in a type error in the example custom document component concerning the styles element in the object returned from getInitialProps.

Here's the error I was getting: https://app.warp.dev/block/sL438l5fIzdlNZ1NIjAcOD

This is resolved by placing the styles elements in an array instead of side-by-side in a fragment.

Bug

  • Related issues linked using fixes #number (no related issues found)
  • Integration tests added (inherited)
  • Errors have helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes by running yarn lint

@ijjk ijjk added the examples Issue/PR related to examples label Apr 22, 2022
@dawsonbooth dawsonbooth changed the title Change styles element fragment to array Change custom document styles element fragment to array in styled-components example Apr 22, 2022
@ijjk ijjk changed the title Change custom document styles element fragment to array in styled-components example Add JSX.Element to styles type in DocumentInitialProps May 23, 2022
Copy link
Member

@ijjk ijjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, looks like this type should be handled so I updated to leave the example as is and fix the internal type, thanks for looking into this!

@ijjk ijjk merged commit 88747a2 into vercel:canary May 23, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples type: next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants