Fixed arity issues in advance of Flow strict checking being enabled (#9816)

This commit is contained in:
Brian Vaughn authored and GitHub committed 2017-05-30 13:50:11 -07:00
1 parent 74044e0eba
commit 8ca82e1df6
6 files changed
+17 -25

No files matched your search

@@ -59,7 +59,7 @@ if (__DEV__) {
'Each child in an array or iterator should have a unique ' +
'"key" prop. See https://fb.me/react-warning-keys for ' +
'more information.' +
(getCurrentFiberStackAddendum(child) || '');
(getCurrentFiberStackAddendum() || '');
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
return;
}
@@ -70,7 +70,7 @@ if (__DEV__) {
'Each child in an array or iterator should have a unique ' +
'"key" prop. See https://fb.me/react-warning-keys for ' +
'more information.%s',
getCurrentFiberStackAddendum(child),
getCurrentFiberStackAddendum(),
);
};
}
@@ -16,7 +16,7 @@ const invariant = require('fbjs/lib/invariant');
import type {CapturedError} from 'ReactFiberScheduler';
const defaultShowDialog = () => true;
const defaultShowDialog = (capturedError: CapturedError) => true;
let showDialog = defaultShowDialog;
@@ -50,7 +50,7 @@ type OpaqueRoot = FiberRoot;
export type HostConfig<T, P, I, TI, PI, C, CX, PL> = {
getRootHostContext(rootContainerInstance: C): CX,
getChildHostContext(parentHostContext: CX, type: T): CX,
getChildHostContext(parentHostContext: CX, type: T, instance: C): CX,
getPublicInstance(instance: I | TI): PI,
createInstance(
@@ -462,7 +462,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
firstEffect = finishedWork.firstEffect;
}
const commitInfo = prepareForCommit();
prepareForCommit();
// Commit all the side-effects within a tree. We'll do this in two passes.
// The first pass performs all the host insertions, updates, deletions and
@@ -474,15 +474,10 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
while (nextEffect !== null) {
let error = null;
if (__DEV__) {
error = invokeGuardedCallback(
null,
commitAllHostEffects,
null,
finishedWork,
);
error = invokeGuardedCallback(null, commitAllHostEffects, null);
} else {
try {
commitAllHostEffects(finishedWork);
commitAllHostEffects();
} catch (e) {
error = e;
}
@@ -504,7 +499,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
stopCommitHostEffectsTimer();
}
resetAfterCommit(commitInfo);
resetAfterCommit();
// The work-in-progress tree is now the current tree. This must come after
// the first pass of the commit phase, so that the previous tree is still
@@ -523,15 +518,10 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
while (nextEffect !== null) {
let error = null;
if (__DEV__) {
error = invokeGuardedCallback(
null,
commitAllLifeCycles,
null,
finishedWork,
);
error = invokeGuardedCallback(null, commitAllLifeCycles, null);
} else {
try {
commitAllLifeCycles(finishedWork);
commitAllLifeCycles();
} catch (e) {
error = e;
}
@@ -28,10 +28,10 @@ var validateCallback = require('validateCallback');
* @implements PooledClass
* @internal
*/
class CallbackQueue<T> {
_callbacks: ?Array<() => void>;
class CallbackQueue<T, Targ> {
_callbacks: ?Array<(arg: Targ) => void>;
_contexts: ?Array<T>;
_arg: ?mixed;
_arg: Targ;
constructor(arg) {
this._callbacks = null;
+4 -2
View File
@@ -95,8 +95,10 @@ var addPoolingTo = function<T>(
CopyConstructor: Class<T>,
pooler: Pooler,
): Class<T> & {
getPooled(): /* arguments of the constructor */ T,
release(): void,
getPooled(
...args: $ReadOnlyArray<mixed>
): /* arguments of the constructor */ T,
release(instance: mixed): void,
} {
// Casting as any so that flow ignores the actual implementation and trusts
// it to match the type we declared