Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
replace this: any with // $FlowFixMe[missing-this-annot
  • Loading branch information
kassens committed Jan 9, 2023
commit cd4f4caed0ce1bd0160b9f413424aaa4b95108b8
9 changes: 2 additions & 7 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,8 @@ type SomeChunk<T> =
| InitializedChunk<T>
| ErroredChunk<T>;

function Chunk(
this: any,
status: any,
value: any,
reason: any,
response: Response,
) {
// $FlowFixMe[missing-this-annot]
function Chunk(status: any, value: any, reason: any, response: Response) {
this.status = status;
this.value = value;
this.reason = reason;
Expand Down
3 changes: 2 additions & 1 deletion packages/react-client/src/ReactFlightClientStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ export function processBinaryChunk(
}

function createFromJSONCallback(response: Response) {
return function(this: any, key: string, value: JSONValue) {
// $FlowFixMe[missing-this-annot]
return function(key: string, value: JSONValue) {
if (typeof value === 'string') {
// We can't use .bind here because we need the "this" value.
return parseModelString(response, this, key, value);
Expand Down
6 changes: 4 additions & 2 deletions packages/react-dom-bindings/src/client/inputValueTracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ function trackValueOnNode(node: any): ?ValueTracker {
const {get, set} = descriptor;
Object.defineProperty(node, valueField, {
configurable: true,
get: function(this: any) {
// $FlowFixMe[missing-this-annot]
get: function() {
return get.call(this);
},
// $FlowFixMe[missing-local-annot]
set: function(this: any, value) {
// $FlowFixMe[missing-this-annot]
set: function(value) {
if (__DEV__) {
checkFormFieldValueStringCoercion(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ function addTrappedEventListener(
// need support for such browsers.
if (enableLegacyFBSupport && isDeferredListenerForLegacyFBSupport) {
const originalListener = listener;
listener = function(this: any, ...p) {
// $FlowFixMe[missing-this-annot]
listener = function(...p) {
removeEventListener(
targetContainer,
domEventName,
Expand Down
11 changes: 7 additions & 4 deletions packages/react-dom-bindings/src/events/SyntheticEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ function createSyntheticEvent(Interface: EventInterfaceType) {
* normalizing browser quirks. Subclasses do not necessarily have to implement a
* DOM interface; custom application-specific events can also subclass this.
*/
// $FlowFixMe[missing-this-annot]
function SyntheticBaseEvent(
this: any,
reactName: string | null,
reactEventType: string,
targetInst: Fiber | null,
Expand Down Expand Up @@ -84,7 +84,8 @@ function createSyntheticEvent(Interface: EventInterfaceType) {

// $FlowFixMe[prop-missing] found when upgrading Flow
assign(SyntheticBaseEvent.prototype, {
preventDefault: function(this: any) {
// $FlowFixMe[missing-this-annot]
preventDefault: function() {
this.defaultPrevented = true;
const event = this.nativeEvent;
if (!event) {
Expand All @@ -100,7 +101,8 @@ function createSyntheticEvent(Interface: EventInterfaceType) {
this.isDefaultPrevented = functionThatReturnsTrue;
},

stopPropagation: function(this: any) {
// $FlowFixMe[missing-this-annot]
stopPropagation: function() {
const event = this.nativeEvent;
if (!event) {
return;
Expand Down Expand Up @@ -424,7 +426,8 @@ const modifierKeyToProp = {
// getModifierState. If getModifierState is not supported, we map it to a set of
// modifier keys exposed by the event. In this case, Lock-keys are not supported.
// $FlowFixMe[missing-local-annot]
function modifierStateGetter(this: any, keyArg) {
// $FlowFixMe[missing-this-annot]
function modifierStateGetter(keyArg) {
const syntheticEvent = this;
const nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom-bindings/src/shared/DOMProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ export function getPropertyInfo(name: string): PropertyInfo | null {
return properties.hasOwnProperty(name) ? properties[name] : null;
}

// $FlowFixMe[missing-this-annot]
function PropertyInfoRecord(
this: any,
name: string,
type: PropertyType,
mustUseProperty: boolean,
Expand Down
13 changes: 7 additions & 6 deletions packages/react-dom/src/client/ReactDOMRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ const defaultOnRecoverableError =
console['error'](error);
};

function ReactDOMRoot(this: any, internalRoot: FiberRoot) {
// $FlowFixMe[missing-this-annot]
function ReactDOMRoot(internalRoot: FiberRoot) {
this._internalRoot = internalRoot;
}

// $FlowFixMe[prop-missing] found when upgrading Flow
// $FlowFixMe[missing-this-annot]
ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = function(
this: any,
children: ReactNodeList,
): void {
const root = this._internalRoot;
Expand Down Expand Up @@ -147,9 +148,8 @@ ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = functio
};

// $FlowFixMe[prop-missing] found when upgrading Flow
ReactDOMHydrationRoot.prototype.unmount = ReactDOMRoot.prototype.unmount = function(
this: any,
): void {
// $FlowFixMe[missing-this-annot]
ReactDOMHydrationRoot.prototype.unmount = ReactDOMRoot.prototype.unmount = function(): void {
if (__DEV__) {
if (typeof arguments[0] === 'function') {
console.error(
Expand Down Expand Up @@ -262,7 +262,8 @@ export function createRoot(
return new ReactDOMRoot(root);
}

function ReactDOMHydrationRoot(this: any, internalRoot: FiberRoot) {
// $FlowFixMe[missing-this-annot]
function ReactDOMHydrationRoot(internalRoot: FiberRoot) {
this._internalRoot = internalRoot;
}
function scheduleHydration(target: Node) {
Expand Down
3 changes: 2 additions & 1 deletion packages/react-reconciler/src/ReactFiberCacheComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import * as Scheduler from 'scheduler';
const AbortControllerLocal: typeof AbortController = enableCache
? typeof AbortController !== 'undefined'
? AbortController
: (function AbortControllerShim(this: any) {
: // $FlowFixMe[missing-this-annot]
(function AbortControllerShim() {
const listeners = [];
const signal = (this.signal = {
aborted: false,
Expand Down
3 changes: 2 additions & 1 deletion packages/react-reconciler/src/ReactFiberThrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ function createClassErrorUpdate(

const inst = fiber.stateNode;
if (inst !== null && typeof inst.componentDidCatch === 'function') {
update.callback = function callback(this: any) {
// $FlowFixMe[missing-this-annot]
update.callback = function callback() {
if (__DEV__) {
markFailedErrorBoundaryForHotReloading(fiber);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,8 @@ module.exports = function register() {
const originalResolveFilename = Module._resolveFilename;

// $FlowFixMe[prop-missing] found when upgrading Flow
Module._resolveFilename = function(
this: any,
request,
parent,
isMain,
options,
) {
// $FlowFixMe[missing-this-annot]
Module._resolveFilename = function(request, parent, isMain, options) {
const resolved = originalResolveFilename.apply(this, arguments);
if (resolved.endsWith('.server.js')) {
if (
Expand Down
7 changes: 2 additions & 5 deletions packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,8 @@ export function createRequest(
identifierPrefix: identifierPrefix || '',
identifierCount: 1,
onError: onError === undefined ? defaultErrorHandler : onError,
toJSON: function(
this: any,
key: string,
value: ReactModel,
): ReactJSONValue {
// $FlowFixMe[missing-this-annot]
toJSON: function(key: string, value: ReactModel): ReactJSONValue {
return resolveModelToJSON(request, this, key, value);
},
};
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/ReactChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ function forEachChildren(
): void {
mapChildren(
children,
function(this: any) {
// $FlowFixMe[missing-this-annot]
function() {
forEachFunc.apply(this, arguments);
// Don't return anything.
},
Expand Down
3 changes: 2 additions & 1 deletion packages/scheduler/src/forks/Scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ function unstable_next<T>(eventHandler: () => T): T {
function unstable_wrapCallback<T: (...Array<mixed>) => mixed>(callback: T): T {
var parentPriorityLevel = currentPriorityLevel;
// $FlowFixMe[incompatible-return]
return function(this: any) {
// $FlowFixMe[missing-this-annot]
return function() {
// This is a fork of runWithPriority, inlined for performance.
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = parentPriorityLevel;
Expand Down
3 changes: 2 additions & 1 deletion packages/scheduler/src/forks/SchedulerMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ function unstable_next<T>(eventHandler: () => T): T {
function unstable_wrapCallback<T: (...Array<mixed>) => mixed>(callback: T): T {
var parentPriorityLevel = currentPriorityLevel;
// $FlowFixMe[incompatible-return]
return function(this: any) {
// $FlowFixMe[missing-this-annot]
return function() {
// This is a fork of runWithPriority, inlined for performance.
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = parentPriorityLevel;
Expand Down
10 changes: 3 additions & 7 deletions packages/shared/invokeGuardedCallbackImpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* @flow
*/

// $FlowFixMe[missing-this-annot]
function invokeGuardedCallbackProd<Args: Array<mixed>, Context>(
this: any,
name: string | null,
func: (...Args) => mixed,
context: Context,
Expand Down Expand Up @@ -63,12 +63,8 @@ if (__DEV__) {
invokeGuardedCallbackImpl = function invokeGuardedCallbackDev<
Args: Array<mixed>,
Context,
>(
this: any,
name: string | null,
func: (...Args) => mixed,
context: Context,
): void {
// $FlowFixMe[missing-this-annot]
>(name: string | null, func: (...Args) => mixed, context: Context): void {
// If document doesn't exist we know for sure we will crash in this method
// when we call document.createEvent(). However this can cause confusing
// errors: https://github.com/facebook/create-react-app/issues/3482
Expand Down