Fix Flow types of useEffectEvent (#26468)

## Summary

Just copied the types over from the internal types. Type error was
hidden by overly broad FlowFixMe. With `$FlowFixMe[not-a-function]` we
would've seen the actual issue:
```
Cannot return `dispatcher.useEffectEvent(...)` because  `T` [1] is incompatible with  undefined [2].Flow(incompatible-return)
```

## How did you test this change?

- [x] yarn flow dom-node
- [x] CI

DiffTrain build for commit https://github.com/facebook/react/commit/d12bdcda69afd219f4d91cbd60d6fae2a375d35b.
This commit is contained in:
eps1lon
2023-03-25 19:28:44 +00:00
parent 57fd488de4
commit e591dc44ab
13 changed files with 23 additions and 23 deletions
@@ -23743,7 +23743,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-next-73b6435ca-20230324";
var ReactVersion = "18.3.0-next-d12bdcda6-20230325";
// Might add PROFILE later.
@@ -8623,7 +8623,7 @@ var devToolsConfig$jscomp$inline_1002 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-73b6435ca-20230324",
version: "18.3.0-next-d12bdcda6-20230325",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1193 = {
@@ -8654,7 +8654,7 @@ var internals$jscomp$inline_1193 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-73b6435ca-20230324"
reconcilerVersion: "18.3.0-next-d12bdcda6-20230325"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1194 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9048,7 +9048,7 @@ var devToolsConfig$jscomp$inline_1045 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-73b6435ca-20230324",
version: "18.3.0-next-d12bdcda6-20230325",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1234 = {
@@ -9079,7 +9079,7 @@ var internals$jscomp$inline_1234 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-73b6435ca-20230324"
reconcilerVersion: "18.3.0-next-d12bdcda6-20230325"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1235 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -27,7 +27,7 @@ if (
}
"use strict";
var ReactVersion = "18.3.0-next-73b6435ca-20230324";
var ReactVersion = "18.3.0-next-d12bdcda6-20230325";
// ATTENTION
// When adding new symbols to this file,
@@ -2071,22 +2071,22 @@ function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
);
}
function useCacheRefresh() {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional
return dispatcher.useCacheRefresh();
}
function use(usable) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional
return dispatcher.use(usable);
}
function useMemoCache(size) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional
return dispatcher.useMemoCache(size);
}
function useEffectEvent(callback) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional
return dispatcher.useEffectEvent(callback);
}
@@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-73b6435ca-20230324";
exports.version = "18.3.0-next-d12bdcda6-20230325";
@@ -642,7 +642,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-73b6435ca-20230324";
exports.version = "18.3.0-next-d12bdcda6-20230325";
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
@@ -1 +1 @@
73b6435ca4e0c3ae3aac8126509a82420a84f0d7
d12bdcda69afd219f4d91cbd60d6fae2a375d35b
@@ -27008,7 +27008,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-next-73b6435ca-20230324";
var ReactVersion = "18.3.0-next-d12bdcda6-20230325";
function createPortal$1(
children,
@@ -9490,7 +9490,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1022 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-73b6435ca-20230324",
version: "18.3.0-next-d12bdcda6-20230325",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -9532,7 +9532,7 @@ var internals$jscomp$inline_1268 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-73b6435ca-20230324"
reconcilerVersion: "18.3.0-next-d12bdcda6-20230325"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1269 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -10198,7 +10198,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1101 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-73b6435ca-20230324",
version: "18.3.0-next-d12bdcda6-20230325",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -10253,7 +10253,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-73b6435ca-20230324"
reconcilerVersion: "18.3.0-next-d12bdcda6-20230325"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
@@ -27548,7 +27548,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-next-73b6435ca-20230324";
var ReactVersion = "18.3.0-next-d12bdcda6-20230325";
function createPortal$1(
children,
@@ -9746,7 +9746,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1081 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-73b6435ca-20230324",
version: "18.3.0-next-d12bdcda6-20230325",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -9788,7 +9788,7 @@ var internals$jscomp$inline_1334 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-73b6435ca-20230324"
reconcilerVersion: "18.3.0-next-d12bdcda6-20230325"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1335 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -10454,7 +10454,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1160 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-73b6435ca-20230324",
version: "18.3.0-next-d12bdcda6-20230325",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -10509,7 +10509,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-73b6435ca-20230324"
reconcilerVersion: "18.3.0-next-d12bdcda6-20230325"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {