Skip to content

Refactor react-modal to use TypeScript #1037

Open
@doeg

Description

@doeg

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions