Skip to content
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

Typescript warning with React 18 types #826

Open
michaeltford opened this issue Aug 3, 2022 · 9 comments
Open

Typescript warning with React 18 types #826

michaeltford opened this issue Aug 3, 2022 · 9 comments

Comments

@michaeltford
Copy link

Describe the bug

When using with @types/react": "^18.0.15 a typescript warning is produced.

This is easily resolved by adding to the Props definition.

children: React.ReactNode; // πŸ‘ˆοΈ added type for children

@Timmmm
Copy link

Timmmm commented Aug 4, 2022

It would help if you included the actual warning. I assuming its the same thing I'm getting:

Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<SplitPane> & Pick<Readonly<Props>, never> & InexactPartial<...> & InexactPartial<...>'.

Although that is an error, not a warning (not sure Typescript even has warnings).

@johnflux
Copy link

johnflux commented Aug 4, 2022

Is there any workaround for this?

@michaeltford
Copy link
Author

@Timmmm . Yes, that's the message and you are correct that it's an error. I fixed this by forking and adding

children: React.ReactNode;

to SplitPaneProps in index.d.ts.

@johnflux I don't know of any workarounds but you could ignore using the react syntax below. (Note - it's 2 lines and will then ignore ALL typescript errors for SplitPane)

    {/* this lib is incompatible with react18. To fix     // children: React.ReactNode; needs to be added to SplitPaneProps.
     // @ts-ignore TS2322 */}
    <SplitPane>

@Timmmm
Copy link

Timmmm commented Aug 4, 2022

Yeah I also just used {/* @ts-ignore */}.

@yhusynin
Copy link

yhusynin commented Aug 8, 2022

Faced with the same issue, here is an example that I've found https://codesandbox.io/s/wr0gf

@dturcotte
Copy link

Here's the react 18 doc reference, children has to be added explicitly to props: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#updates-to-typescript-definitions

@HristoP96
Copy link

So nobody is going to fix this small issue ?

@vimalsharma124
Copy link

facing similar issue

@vimalsharma124
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants