我尝试将material-tailwind/react **Carousel **组件添加到我的Applayout.tsx,但我遇到了问题
" Type '{children: Element[]; className: string; placeholder: undefined; }' 缺少类型 'Pick
import React from "react";
import { Outlet } from "react-router-dom";
import { Header } from "../pages/Header";
import {
Carousel
} from "@material-tailwind/react";
const AppLayout = () => {
return (
<div>
<Header />
<Outlet />
<Carousel className="rounded-xl"> //issue here
<img
src="https://images.unsplash.com/photo-1497436072909-60f360e1d4b1?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2560&q=80"
alt="image 1"
className="h-full w-full object-cover"
/>
<img
src="https://images.unsplash.com/photo-1493246507139-91e8fad9978e?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2940&q=80"
alt="image 2"
className="h-full w-full object-cover"
/>
<img
src="https://images.unsplash.com/photo-1518623489648-a173ef7824f3?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2762&q=80"
alt="image 3"
className="h-full w-full object-cover"
/>
</Carousel>
</div>
);
};
export { AppLayout };
I also config @material-tailwind/react, here you guys can see.
const withMT = require("@material-tailwind/react/utils/withMT");
module.exports = withMT({
content: [
"./src/**/*.{js,jsx,ts,tsx}",
"./**/@material-tailwind/**/*.{html,js,ts,jsx,tsx,mdx}"
],
theme: {
extend: {},
},
plugins: [],
});
请帮我这个
Carousel 和 @material-tailwind/react 上的其他人的问题 错误信息
您的
@types/react
版本是什么?
我降级到"@types/react": "18.2.42"
并且它起作用了。
"@types/react": "18.2.42"
是最后一个工作版本。看来问题是在合并时引入的 DefinitelyTyped/DefinitelyTyped#67170