Compilation Error with Nivo
Unanswered
Albacore posted this in #help-forum
AlbacoreOP
Hello. I'm trying to use Nivo Responsive line charts. It works great in dev mode
I have tried multiple ways to satisfy the typescript gods here including (as you can see) wrapping it in a div and a React.Fragment.. I'm at a loss here... what do I need to do to make this compile..
Here's is the piece of code: https://gist.github.com/parabuzzle/2349ba85691d7148e2c5af3fecaf4a86
If I remove
using Next 14.1.4, React and React-dom 18.2.0 in a turbo repo setup with turbo repo version 1.13.3
yarn dev .. but when I try to do a yarn build it fails with this error:landing:build:
landing:build: ../../packages/ui2/graphing/node-metric.tsx:88:12
landing:build: Type error: 'ResponsiveLine' cannot be used as a JSX component.
landing:build: Its instance type 'ResponsiveLine' is not a valid JSX element.
landing:build: The types returned by 'render()' are incompatible between these types.
landing:build: Type 'React.ReactNode' is not assignable to type 'import("/<redacted>/web/frontends/node_modules/@types/react-dom/node_modules/@types/react/ts5.0/index").ReactNode'.
landing:build: Type 'PromiseLikeOfReactNode' is not assignable to type 'ReactNode'.
landing:build:
landing:build: 86 | <div style={{ height: height || 300 }}>
landing:build: 87 | <React.Fragment>
landing:build: > 88 | <ResponsiveLine
landing:build: | ^
landing:build: 89 | animate
landing:build: 90 | data={metrics}
landing:build: 91 | theme={darkTheme}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
landing:build: ERROR: command finished with error: command (/<redacted>/web/frontends/apps/landing) /tmp/yarn--1717983842307-0.37639865558186814/yarn run build exited (1)I have tried multiple ways to satisfy the typescript gods here including (as you can see) wrapping it in a div and a React.Fragment.. I'm at a loss here... what do I need to do to make this compile..
Here's is the piece of code: https://gist.github.com/parabuzzle/2349ba85691d7148e2c5af3fecaf4a86
If I remove
<ResponiveLine it compiles fine.. so it is very much that component.using Next 14.1.4, React and React-dom 18.2.0 in a turbo repo setup with turbo repo version 1.13.3
1 Reply
AlbacoreOP
found this.. seems to make the compliation error go away and seems wrong.. but at least I'm now unblocked.. https://github.com/vercel/next.js/issues/42292