Error: TypeScript 4.1: Could not find a declaration file for module ‘react/jsx-runtime’

Sometimes while working with React TypeScript, there are weird errors. One among them could be this.

Cannot find module ‘react/jsx-runtime’ or its corresponding type declarations.

There are several ways to go past this. The best one which worked for me among them is adding this piece of code in react-app-env.d.ts file.

declare module "react/jsx-runtime" {
  export default any;

Refer to this issue for more

Keep Coding 🎨

Published by Jayesh

I code and energize, loves sharing my journey.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s