question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Next.js] Using TypeScript enum outside of dynamic component causes styled.div is not a function

See original GitHub issue

We get the TypeError: styled.div is not a function when using the GridCellKind enum outside of the dynamic component in Next.js.

I understand why we need to dynamically import DataEditor in Next.js but is there a way to import the enum’s independently from the React code?

The work around for us is to copy the enum(s) from the data-grid-types.d.ts and put them in our code directly to prevent the TypeError.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
jassmithcommented, Jul 7, 2022

Alpha 5 is rolling now with a fix for that build error

1reaction
jassmithcommented, Jul 7, 2022

If you want to go the extra mile, modify the next-js project test in this repo to reproduce this on the 5.0.0 branch so I never break this again 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when accessing Typescript enum defined outside Next ...
This is the expected behavior because you're importing a file outside of your application root. TypeScript files are not processed there. You'll ...
Read more >
The component styled...has been created dynamically. You ...
you can create a Column component as styles component and make use of props to set the specific attributes const Column = styled.div`...
Read more >
Routing in Next.js – How to Set Up Dynamic Routing with Pre ...
While we are focusing on the actual logic of the required code, I won't do any CSS styling whatsoever. Feel free to get...
Read more >
React conditional rendering: 9 methods with examples
If you want to iterate over a list to render more than one component or implement some conditional logic, you have to use...
Read more >
typescript-cheatsheet - GitHub Pages
Functions as you may expect work exactly the same as in JavaScript with a couple new features ... The reason is because 5...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found