rmariuzzo / react-new-window

🔲 Pop new windows in React, using `window.open`.
https://rmariuzzo.github.io/react-new-window/
MIT License
442 stars 107 forks source link

Type definition bug: React 18 requires `children` be defined. #118

Closed disambiguator closed 1 year ago

disambiguator commented 2 years ago

The package currently causes type errors on React 18 because it does not explicitly define children as a prop.

RobRendell commented 2 years ago

In the meantime, you can create a react-new-window.d.ts definition file for react-new-window in your own @types folder which updates the prop definition:

import React, {PropsWithChildren} from 'react';

declare module 'react-new-window' {
    import {INewWindowProps} from 'react-new-window';

    export default class NewWindow extends React.PureComponent<PropsWithChildren<INewWindowProps>> {};
}