Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Commit

Permalink
Add annotations to unannotated variable declarations in html/shared […
Browse files Browse the repository at this point in the history
…manually-modified]

Reviewed By: evanyeung

Differential Revision: D35587500

fbshipit-source-id: b6277f8bd07de376d6ea4312ed9f6c44d5f2f94a
  • Loading branch information
pieterv authored and facebook-github-bot committed Apr 13, 2022
1 parent 0541024 commit 1274a1c
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/recoil/core/__tests__/Recoil_RecoilRoot-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ describe('initializeState', () => {
const [ReadsWritesAtom, setAtom] = componentThatReadsAndWritesAtom(myAtom);

const initializeState = jest.fn(({set}) => set(myAtom, 'INIT'));
let forceUpdate = () => {
let forceUpdate: $FlowFixMe = () => {
throw new Error('not rendered');
};
let setRootKey = _ => {
let setRootKey: $FlowFixMe = _ => {
throw new Error('');
};
function MyRoot() {
Expand Down
2 changes: 1 addition & 1 deletion packages/recoil/core/__tests__/Recoil_Snapshot-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ describe('Atom effects', () => {
],
});

let setMount = _ => {
let setMount: $FlowFixMe = _ => {
throw new Error('Test Error');
};
function Component() {
Expand Down
2 changes: 1 addition & 1 deletion packages/recoil/hooks/__tests__/Recoil_PublicHooks-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ testRecoil(
function testWithOrder(order) {
const anAtom = counterAtom();

let q = [];
let q: Array<$FlowFixMe> = [];
let seen = false;
const original = Queue.enqueueExecution;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ describe('Snapshot Retention', () => {
],
});

let setMount = _ => {
let setMount: $FlowFixMe = _ => {
throw new Error('Test Error');
};
function UseRecoilSnapshot() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ let id = 0;
function asyncSelector<T, S>(
dep?: RecoilValue<S>,
): [RecoilValue<T>, (T) => void, (Error) => void, () => boolean] {
let resolve = () => invariant(false, 'bug in test code'); // make flow happy with initialization
let reject = () => invariant(false, 'bug in test code');
let resolve: (() => void) | ((result: Promise<T> | T) => void) = () =>
invariant(false, 'bug in test code'); // make flow happy with initialization
let reject: (() => void) | ((error: $FlowFixMe) => void) = () =>
invariant(false, 'bug in test code');
let evaluated = false;
const promise = new Promise((res, rej) => {
resolve = res;
Expand All @@ -96,6 +98,7 @@ function asyncSelector<T, S>(
return promise;
},
});
// $FlowFixMe[incompatible-return]
return [sel, resolve, reject, () => evaluated];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ describe('Effects', () => {
],
});

let setMount = _ => {
let setMount: $FlowFixMe = _ => {
throw new Error('Test Error');
};
const [ReadWriteAtom, setAtom] = componentThatReadsAndWritesAtom(myAtom);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,13 @@ function asyncSelectorThatPushesPromisesOntoArray(dep: RecoilValue<any>) {
key: `selector${nextID++}`,
get: ({get}) => {
get(dep);
let resolve = _ => invariant(false, 'bug in test code'); // make flow happy with initialization
let reject = _ => invariant(false, 'bug in test code');
let resolve:
| ((_: number | $TEMPORARY$string<'hello'>) => $FlowFixMeEmpty)
// $FlowFixMe[speculation-ambiguous]
| ((result: Promise<$FlowFixMe> | $FlowFixMe) => void) = _ =>
invariant(false, 'bug in test code'); // make flow happy with initialization
let reject: (error: $FlowFixMe) => void = _ =>
invariant(false, 'bug in test code');
const p = new Promise((res, rej) => {
resolve = res;
reject = rej;
Expand Down Expand Up @@ -1572,7 +1577,7 @@ describe('Async Selectors', () => {
key: 'notifiesAllStores/snapshots/a',
get: () => 'foo',
});
let resolve = _ => {
let resolve: $FlowFixMe = _ => {
throw new Error('error in test');
};
const selectorB = selector({
Expand Down Expand Up @@ -1633,7 +1638,7 @@ describe('Async Selectors', () => {
get: () => 'SELECTOR A',
});

let resolve = _ => {
let resolve: $FlowFixMe = _ => {
throw new Error('error in test');
};
const selectorB = selector({
Expand Down
2 changes: 1 addition & 1 deletion packages/refine/Refine_Checkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Path {

toString(): string {
const pieces = [];
let current = this;
let current: ?Path = this;

while (current != null) {
const {field, parent} = current;
Expand Down
7 changes: 5 additions & 2 deletions packages/shared/__test_utils__/Recoil_TestingUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ const loadingAsyncSelector: () => RecoilValueReadOnly<void> = () =>
function asyncSelector<T, S>(
dep?: RecoilValue<S>,
): [RecoilValue<T>, (T) => void, (Error) => void] {
let resolve = () => invariant(false, 'bug in test code'); // make flow happy with initialization
let reject = () => invariant(false, 'bug in test code');
let resolve: (() => void) | ((result: Promise<T> | T) => void) = () =>
invariant(false, 'bug in test code'); // make flow happy with initialization
let reject: (() => void) | ((error: $FlowFixMe) => void) = () =>
invariant(false, 'bug in test code');
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
Expand All @@ -264,6 +266,7 @@ function asyncSelector<T, S>(
return promise;
},
});
// $FlowFixMe[incompatible-return]
return [sel, resolve, reject];
}

Expand Down

0 comments on commit 1274a1c

Please sign in to comment.