Skip to content

[flow] Label dictionary keys in published Flow types - #528

Merged
SamChou19815 merged 1 commit into
react:mainfrom
SamChou19815:flow-label-dictionary-keys
Nov 7, 2026
Merged

SamChou19815 merged 1 commit into
react:mainfrom
SamChou19815:flow-label-dictionary-keys

Conversation

@SamChou19815

Copy link
Copy Markdown
Member

Flow's experimental.require_dictionary_key_label option requires every dictionary key to be labeled, as TypeScript does:

type T = { [string]: number }; // error
type T = { [key: string]: number }; // ok

This labels the four unlabeled keys that end up in the package's published .js.flow files: ReactDOMStyleProps's style, Styles, MutableCustomProperties, and the style prop of merge's return type. Labels don't affect type checking.

Test plan

flow full-check with Flow 0.338.0, using a copy of .flowconfig updated for 0.338 with the option turned on: the four missing-dictionary-key-label errors in renderer.web.js, styles.js and merge.js are gone, and no other errors change. prettier --check passes on the changed files.

Flow's `experimental.require_dictionary_key_label` option requires every dictionary key to be labeled, as TypeScript does:

```js
type T = { [string]: number }; // error
type T = { [key: string]: number }; // ok
```

This labels the four unlabeled keys that end up in the package's published `.js.flow` files: `ReactDOMStyleProps`'s `style`, `Styles`, `MutableCustomProperties`, and the `style` prop of `merge`'s return type. Labels don't affect type checking.

## Test plan

`flow full-check` with Flow 0.338.0, using a copy of `.flowconfig` updated for 0.338 with the option turned on: the four `missing-dictionary-key-label` errors in `renderer.web.js`, `styles.js` and `merge.js` are gone, and no other errors change. `prettier --check` passes on the changed files.
@meta-cla meta-cla Bot added the cla signed label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

workflow: benchmarks/perf (native)

Comparison of performance test results, measured in operations per second. Larger is better.

Results Base Patch Ratio
css.create
· small 1,938,907 1,980,847 1.02 +
· small with units 903,043 923,769 1.02 +
· small with variables 1,208,439 1,172,472 0.97 -
· several small 636,536 629,888 0.99 -
· large 358,045 362,992 1.01 +
· large with polyfills 263,456 270,569 1.03 +
· complex 187,980 184,713 0.98 -
· unsupported 390,912 386,423 0.99 -
css.createTheme
· simple theme 379,556 398,665 1.05 !!
· polyfill theme 383,950 390,029 1.02 +

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.

Results Base Patch Ratio
react-strict-dom/dist/web/index.js
· compressed 3,251 3,251 1.00
· minified 10,375 10,375 1.00
react-strict-dom/dist/web/runtime.js
· compressed 1,645 1,645 1.00
· minified 4,131 4,131 1.00
react-strict-dom/dist/native/index.js
· compressed 16,850 16,850 1.00
· minified 65,487 65,487 1.00
react-strict-animated/dist/web/index.js
· compressed 6,861 6,861 1.00
· minified 23,486 23,486 1.00
react-strict-animated/dist/native/index.js
· compressed 797 797 1.00
· minified 2,518 2,518 1.00

@SamChou19815
SamChou19815 merged commit f3fbeaa into react:main Nov 7, 2026
8 checks passed
@SamChou19815
SamChou19815 deleted the flow-label-dictionary-keys branch November 7, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant