Description
I wanted to open a ticket to discuss the possibility of refactoring this library to use TypeScript. 😸
In addition to all of the benefits typed code has with respect to safety, productivity, and maintainability, built-in types would also remove the need for third-party type definitions. (See https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-modal.)
If we adopt this proposal, we could (and arguably should) do this as a progressive enhancement to the library. Some related guides on adding TypeScript to existing projects:
- https://github.com/Microsoft/TypeScript-React-Conversion-Guide#typescript-react-conversion-guide
- https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html
This dovetails with #1036, which proposes a new build system to replace bespoke webpack. If the plan is indeed to move away from webpack, starting with #1036 and then integrating TypeScript after would be the most reasonable sequence of events, I think. :)
#960 is a related issue that flags a type error ('ReactModal' cannot be used as a JSX component
) arising from using react-modal with React 18.
@diasbruno would love to know your thoughts on this. 🙇 I did not see any previous discussions around adopting TypeScript in the issues/pull requests for this repo.