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

Flow type support for data-* props #71

Open
necolas opened this issue Apr 3, 2024 · 1 comment
Open

Flow type support for data-* props #71

necolas opened this issue Apr 3, 2024 · 1 comment
Labels
bug Something isn't working improvement Technical improvement

Comments

@necolas
Copy link
Contributor

necolas commented Apr 3, 2024

Describe the feature request

Flow doesn't have support for typing arbitrary data-* props. This requires RSD to add Meta-specific data-* props on an as-needed basis, and each time it is considered a "blocker" by the team migrating components to RSD. This creates incentives to either 1) patch internally generated RSD syncs with new Flow types (complicates syncs, can cause regressions), or 2) add Meta-specific props to the OSS project code (doesn't scale to other users).

cc @jbrown215 who had ideas on how to support this from the Flow side

@necolas necolas added bug Something isn't working improvement Technical improvement labels Apr 3, 2024
@nmn
Copy link
Contributor

nmn commented Apr 4, 2024

While we wait for the Flow team to prioritise and implement the Template Literal Types feature, a stop gap solution would be to create a separate file just for the data-* properties and split it out from StrictReactDOMProps.

This will avoid the need for patch files when we try to maintain a list of props used internally.

We can also shadow this file with a .d.ts file which uses template literal types so Typescript users don't have to deal with this Flow limitation.

necolas pushed a commit that referenced this issue Apr 4, 2024
Allow arbitrary data-* props at runtime. On web, the check is only
performed during development.

To workaround Flow's lack of support for typing arbitary data-* props, a
separate type is created just for data-* props which can be used to
maintain an app's list of supported data-* props.

Ref #71
Close #75
necolas pushed a commit that referenced this issue Apr 4, 2024
Allow arbitrary data-* props at runtime. On web, the check is only
performed during development.

To workaround Flow's lack of support for typing arbitary data-* props, a
separate type is created just for data-* props which can be used to
maintain an app's list of supported data-* props.

Ref #71
Close #75
necolas added a commit that referenced this issue Apr 5, 2024
Allow arbitrary data-* props at runtime. On web, the check is only
performed during development.

To workaround Flow's lack of support for typing arbitary data-* props, a
separate type is created just for data-* props which can be used to
maintain an app's list of supported data-* props.

Ref #71
Close #75
necolas added a commit that referenced this issue Apr 5, 2024
Allow arbitrary data-* props at runtime. On web, the check is only
performed during development.

To workaround Flow's lack of support for typing arbitary data-* props, a
separate type is created just for data-* props which can be used to
maintain an app's list of supported data-* props.

Ref #71
Close #75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement Technical improvement
Projects
None yet
Development

No branches or pull requests

2 participants