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

Attempt to use Flow's new StringPrefix feature #171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[version]
0.240.0
0.241.0

[ignore]
.*/malformed_package_json/.*
Expand Down
74 changes: 37 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-react-hooks": "^4.5.0",
"flow-api-translator": "^0.22.0",
"flow-bin": "^0.240.0",
"flow-api-translator": "^0.23.0",
"flow-bin": "^0.241.0",
"husky": "^8.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ type EventProps = $ReadOnly<{
}>;

export type StrictReactDOMProps = $ReadOnly<{
[StringPrefix<'data-'>]: ?string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check if the generated TS types work as expected?

If so, this LGTM.

...AriaProps,
...EventProps,
...ReactStrictDOMDataProps,
autoCapitalize?: ?(
| 'off'
| 'none'
Expand All @@ -293,7 +293,6 @@ export type StrictReactDOMProps = $ReadOnly<{
),
autoFocus?: ?boolean,
children?: React$Node,
'data-testid'?: ?string,
dir?: ?('auto' | 'ltr' | 'rtl'),
elementTiming?: ?string,
enterKeyHint?: ?(
Expand Down
5 changes: 0 additions & 5 deletions tools/flow-typed/react-strict-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
* @flow strict
*/

// This type allows Meta (and other users) to define data-*
// props used by their components to work around Flow's current
// lack of support for typing arbitrary data-* props.
declare type ReactStrictDOMDataProps = {};

// This type allows Meta to internally override it with an
// internationalization type which is a string at runtime…
// but Flow doesn't know that.
Expand Down
Loading