Flow upgrade to 0.155

This version banned use of this in object functions.

ghstack-source-id: f49fd5e1b7
Pull Request resolved: https://github.com/facebook/react/pull/25414
This commit is contained in:
Jan Kassens 2022-10-04 11:39:26 -04:00
parent 8bc95bb3c8
commit 338e6a967c
6 changed files with 33 additions and 6 deletions

View File

@ -63,7 +63,7 @@
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
"fbjs-scripts": "1.2.0",
"filesize": "^6.0.1",
"flow-bin": "^0.154.0",
"flow-bin": "^0.155.0",
"glob": "^7.1.6",
"glob-stream": "^6.1.0",
"google-closure-compiler": "^20200517.0.0",

View File

@ -218,10 +218,12 @@ export function attach(
const internalInstance = args[0];
const hostContainerInfo = args[3];
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return fn.apply(this, args);
}
if (hostContainerInfo._topLevelWrapper === undefined) {
// SSR
// $FlowFixMe[object-this-reference] found when upgrading Flow
return fn.apply(this, args);
}
@ -241,6 +243,7 @@ export function attach(
);
try {
// $FlowFixMe[object-this-reference] found when upgrading Flow
const result = fn.apply(this, args);
parentIDStack.pop();
return result;
@ -260,6 +263,7 @@ export function attach(
performUpdateIfNecessary(fn, args) {
const internalInstance = args[0];
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return fn.apply(this, args);
}
@ -268,6 +272,7 @@ export function attach(
const prevChildren = getChildren(internalInstance);
try {
// $FlowFixMe[object-this-reference] found when upgrading Flow
const result = fn.apply(this, args);
const nextChildren = getChildren(internalInstance);
@ -294,6 +299,7 @@ export function attach(
receiveComponent(fn, args) {
const internalInstance = args[0];
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return fn.apply(this, args);
}
@ -302,6 +308,7 @@ export function attach(
const prevChildren = getChildren(internalInstance);
try {
// $FlowFixMe[object-this-reference] found when upgrading Flow
const result = fn.apply(this, args);
const nextChildren = getChildren(internalInstance);
@ -328,12 +335,14 @@ export function attach(
unmountComponent(fn, args) {
const internalInstance = args[0];
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return fn.apply(this, args);
}
const id = getID(internalInstance);
parentIDStack.push(id);
try {
// $FlowFixMe[object-this-reference] found when upgrading Flow
const result = fn.apply(this, args);
parentIDStack.pop();

View File

@ -98,27 +98,36 @@ Response.prototype = {
constructor: Response,
arrayBuffer() {
return readRecordValue(
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._arrayBuffer ||
// $FlowFixMe[object-this-reference] found when upgrading Flow
(this._arrayBuffer = createRecordFromThenable(
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._response.arrayBuffer(),
)),
);
},
blob() {
return readRecordValue(
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._blob ||
// $FlowFixMe[object-this-reference] found when upgrading Flow
(this._blob = createRecordFromThenable(this._response.blob())),
);
},
json() {
return readRecordValue(
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._json ||
// $FlowFixMe[object-this-reference] found when upgrading Flow
(this._json = createRecordFromThenable(this._response.json())),
);
},
text() {
return readRecordValue(
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._text ||
// $FlowFixMe[object-this-reference] found when upgrading Flow
(this._text = createRecordFromThenable(this._response.text())),
);
},

View File

@ -143,6 +143,7 @@ function Response(nativeResponse) {
Response.prototype = {
constructor: Response,
arrayBuffer() {
// $FlowFixMe[object-this-reference] found when upgrading Flow
const buffer = readRecordValue(this._bufferRecord);
return buffer;
},
@ -151,20 +152,28 @@ Response.prototype = {
throw new Error('Not implemented.');
},
json() {
// $FlowFixMe[object-this-reference] found when upgrading Flow
if (this._json !== null) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return this._json;
}
// $FlowFixMe[object-this-reference] found when upgrading Flow
const buffer = readRecordValue(this._bufferRecord);
const json = JSON.parse(buffer.toString());
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._json = json;
return json;
},
text() {
// $FlowFixMe[object-this-reference] found when upgrading Flow
if (this._text !== null) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return this._text;
}
// $FlowFixMe[object-this-reference] found when upgrading Flow
const buffer = readRecordValue(this._bufferRecord);
const text = buffer.toString();
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._text = text;
return text;
},

View File

@ -47,4 +47,4 @@ munge_underscores=false
%REACT_RENDERER_FLOW_OPTIONS%
[version]
^0.154.0
^0.155.0

View File

@ -7912,10 +7912,10 @@ flatted@^2.0.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==
flow-bin@^0.154.0:
version "0.154.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.154.0.tgz#e086964398e671daa8f56ed8663d7876337f77e5"
integrity sha512-I6u2ETdkAyard+8C5na6bfZp4EM0zIMB7O5zH4GKzBLv9/y8/NYRTxEXQe5T0hvj9R9DxFBUoPsFK76ziweUFw==
flow-bin@^0.155.0:
version "0.155.1"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.155.1.tgz#1263ee3e0f42d11cb13ba56c3851a096213ce5f7"
integrity sha512-qy2eXkgngR6u+MYA1ydzPnclhos21BZlpkJ50Y9YOZ4eTMq6txswB3X+gUsg8XUyCteLoMeo7n30k7aY2no2Yw==
fluent-syntax@0.13.0:
version "0.13.0"