I’m creating a project using vite react-ts, then I’m trying to install the package @material-tailwind/react, I’ve made sure the package is installed in package.json with version
"@material-tailwind/react": "^2.0.7",
I’ve also configured tailwind.config.js as follows:
import withMT from "@material-tailwind/react/utils/withMT";
/** @type {import('tailwindcss').Config} */
module.exports = withMT({
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
colors: {
palette: {
bg: "#f8f9fa",
white: "#fff",
down: "#FF1700",
up: "#06FF00",
100: "#4B49AC",
200: "#eef2ff",
300: "#7DA0FA",
400: "#7978E9",
500: "#F3797E",
},
},
},
plugins: [],
});
in the main.tsx section, I have also configured the following:
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import "./index. css";
import { ThemeProvider } from "@material-tailwind/react";
ReactDOM.createRoot(document.getElementById("root")!).render(
<React. StrictMode>
<ThemeProvider>
<App />
</ThemeProvider>
</React. StrictMode>
);
why when I hover over import { ThemeProvider } from "@material-tailwind/react" I get typescript error ‘Cannot find module ‘@material-tailwind/react’ or its corresponding type declarations.’?
how to solve that error?
2
Answers
I found the same issue for version v2.0.7. You can either downgrade the package to v2.0.6 (or older) or try this way:
I have the same error, when I downgrade then it finds the package but it gives me the following error:
enter image description here