-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🧐[问题]关于ThemeProvider ts类型问题 #108
Comments
有示例代码么 |
|
你的用法明显是错的… import { useState } from "react";
import { ThemeProvider } from "antd-style"
import reactLogo from "./assets/react.svg";
import "./App.css";
function App() {
const [count, setCount] = useState(0);
return (
<ThemeProvider themeMode={'auto'} >
<div className="App">
</div>
</ThemeProvider>
);
}
export default App |
这样使用在vscode 会有一个错误 |
这个应该是你的 react 版本不对。升级到最新的 @types/react 应该就好了: #63 |
找到问题了 因为我的typescript版本是4 在@types/react中 package.json
这导致了FunctionComponent类型声明有些许差异 |
🧐 问题描述
💻 示例代码
ThemeProvider: <T = any, S = any>(props: import("..").ThemeProviderProps<T, S>) => import("react").ReactNode
但是它实际上是一个Object,因为我将它当成一个函数调用时 会报错ThemeProvider is not a function
🚑 其他信息
The text was updated successfully, but these errors were encountered: