ant-design / antd-style

css-in-js library with antd v5 token system
https://ant-design.github.io/antd-style/
MIT License
187 stars 29 forks source link

🐛[BUG] Erroneous type of ThemeProvider #63

Closed alex-golubtsov closed 1 year ago

alex-golubtsov commented 1 year ago

This change breaks ThemeProvider rendering.

Demo:

image

It makes perfect sense, since ReactNode cannot be returned byReact.FC

arvinxx commented 1 year ago

Thanks for your issuing, could your please show me a codesandbox to debug it? I try with @types/react^18 ,it seems work well.

arvinxx commented 1 year ago

if you check the types in @types/react@18, you will see FunctionComponent ( alias of FC ) return ReactNode (Line 553).

antd-style 's peerDeps is:

  "peerDependencies": {
    "react": ">=18"
  }

So I think it's not a bug.

alex-golubtsov commented 1 year ago

@arvinxx currently @types/react uses ts5.0 types. I don't understand why they do it even for ts versions < 5, but that's how it is. And there is ReactElement instead of ReactNode.

Probably worth to investigate. Which version of @types/react do you rely on? Bet it's < 18.0.37

arvinxx commented 1 year ago

Which version of @types/react do you rely on? Bet it's < 18.0.37

@alex-golubtsov latest, 18.2.8: https://unpkg.com/browse/@types/react@18.2.8/index.d.ts

alex-golubtsov commented 1 year ago

Which version of @types/react do you rely on? Bet it's < 18.0.37

@alex-golubtsov latest, 18.2.8: https://unpkg.com/browse/@types/react@18.2.8/index.d.ts

@arvinxx thanks for the clarification! It finally works with typescript ^5