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.

Type '{}' is not assignable to type 'ReactNode'.

See original GitHub issue

Verify canary release

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

Provide environment information

“next”: “12.1.4”, “react”: “^17.0.2”, “react-dom”: “^17.0.2”, file tsconfig.json

{
  "compilerOptions": {
    "target": "es6",
    "esModuleInterop": true,
    "importHelpers": true,
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "dom.iterable",
      "esnext",
      "es5",
      "es6"
    ],
    "baseUrl": ".", // setting a value for baseUrl is required
    "paths": {
      "@/*": [
        "*"
      ],
      "~/*": [
        "*"
      ]
    },
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "declaration": true,
    "downlevelIteration": true,
    "noUnusedParameters": false,
    "noUnusedLocals": false,
    "incremental": true
  },
  "exclude": [
    "node_modules",
    ".next",
    ".vscode",
    "out"
  ],
  "include": [
    "**/styles/**/*",
    "**/*.ts",
    "**/*.tsx",
    "**/*.yml",
    "**/*.yaml",
    "**/*.css",
    "**/*.scss",
    "**/*",
    ".d.ts",
    "next-env.d.ts",
  ]
}

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

The issue is that after upgrading to the last nextjs version, I am getting the error Type 'Component<{}, any, any>' is not assignable to type 'Element | ElementClass | null' for all components that are imported dynamically. Workaround: Change dynamic import to normal import solves the issue

Expected Behavior

it should work.

To Reproduce

create a component and import it dynamically

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:19
  • Comments:29 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
raphaelcamarcommented, Apr 8, 2022

I´m having the same issue. the app build doesn´t run correctly. Yesterday was running correctly. Today is broken

12reactions
Alexcsmbzcommented, Apr 8, 2022

I have the same problem 😦 ecosystem project: react-ts All dependencies in the project aren’t auto-updating and are hardcoded (without ^) yesterday it works correctly too, today it is broken.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type '{}' is not assignable to type 'ReactNode' - Stack Overflow
We started experiencing this issue on our build server without making significant changes last week and have not managed to find a fix...
Read more >
Type {} is not assignable to ReactNode FIX - YouTube
In this video extract we fix the react native typescript error: Type {} is not assignable to ReactNode.
Read more >
jsx element not assignable type functioncomponent
The React.js error "Type '() => JSX.Element[]' is not assignable to type FunctionComponent" occurs when we try to return an array of elements...
Read more >
type 'number' is not assignable to type 'reactnode'. - You.com
Type 'number or undefined' is not assignable to type number # The "Type 'number | undefined' is not assignable to type number" error...
Read more >
Type 'ReactPortal' is not assignable to type 'ReactNode' - Reddit
Hello with the new @types/react I'm facing several issues. One of them is Type 'ReactPortal' is not assignable to type 'ReactNode'.
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