Skip to content

Fix: Could not find a declaration file for module 'react-dom/client' when running the project  #162

Open
@sanG-github

Description

@sanG-github

Issue

This error was raised the first time I start the project. But I tried this solution and it works as expected.

ERROR in src/index.tsx:4:28
TS7016: Could not find a declaration file for module 'react-dom/client'. '/Users/sang.huynh/Desktop/react-template/node_modules/react-dom/client.js' implicitly has an 'any' type.
  If the 'react-dom' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom'
    2 | import { BrowserRouter } from 'react-router-dom';
    3 |
  > 4 | import { createRoot } from 'react-dom/client';
      |                            ^^^^^^^^^^^^^^^^^^
    5 |
    6 | import App from './App';
    7 | import configureI18n from './i18n';

Expected

yarn run start works like a champ.

Steps to reproduce

  1. generate the project with either Bootstrap or Tailwind
  2. run yarn install to install all dependencies
  3. run yarn run start
  4. The error appear in the browser

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions