Skip to content

[flow] Name function type params in published Flow types - #527

Merged
SamChou19815 merged 1 commit into
react:mainfrom
SamChou19815:flow-name-function-type-params
Nov 7, 2026
Merged

SamChou19815 merged 1 commit into
react:mainfrom
SamChou19815:flow-name-function-type-params

Conversation

@SamChou19815

Copy link
Copy Markdown
Member

Flow's experimental.require_function_type_param_name option requires every function type param to be named, as TypeScript does:

type T = (string) => void; // error
type T = (v: string) => void; // ok

This names the two unnamed params that end up in the package's published .js.flow files: useElementCallback's callback and ReactRef. Param names 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 two missing-function-type-param-name errors in useElementCallback.js and Utilities.js are gone, and no other errors change.

Flow's `experimental.require_function_type_param_name` option requires every function type param to be named, as TypeScript does:

```js
type T = (string) => void; // error
type T = (v: string) => void; // ok
```

This names the two unnamed params that end up in the package's published `.js.flow` files: `useElementCallback`'s `callback` and `ReactRef`. Param names 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 two `missing-function-type-param-name` errors in `useElementCallback.js` and `Utilities.js` are gone, and no other errors change.
@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,876,738 1,918,826 1.02 +
· small with units 888,088 920,408 1.04 +
· small with variables 1,121,222 1,176,409 1.05 +
· several small 623,447 642,878 1.03 +
· large 350,816 357,938 1.02 +
· large with polyfills 255,475 266,158 1.04 +
· complex 179,262 181,770 1.01 +
· unsupported 386,905 386,939 1.00 +
css.createTheme
· simple theme 403,902 424,833 1.05 !!
· polyfill theme 405,124 394,781 0.97 -

@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 14a5f55 into react:main Nov 7, 2026
8 checks passed
@SamChou19815
SamChou19815 deleted the flow-name-function-type-params branch November 7, 2026 16:30
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