Skip to content

Commit 8d69632

Browse files
committed
flow, lint, prettier
1 parent 44ea2a8 commit 8d69632

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

packages/react-native-renderer/src/ReactNativeAttributePayload.js

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,15 @@ function diffProperties(
444444
return updatePayload;
445445
}
446446

447-
function fastAddProperties(updatePayload, nextProps, validAttributes) {
448-
var attributeConfig;
449-
var nextProp;
450-
451-
for (var propKey in nextProps) {
447+
function fastAddProperties(
448+
updatePayload: null | Object,
449+
nextProps: Object,
450+
validAttributes: AttributeConfiguration,
451+
): null | Object {
452+
let attributeConfig;
453+
let nextProp;
452454

455+
for (const propKey in nextProps) {
453456
nextProp = nextProps[propKey];
454457

455458
if (nextProp === undefined) {
@@ -462,34 +465,42 @@ function fastAddProperties(updatePayload, nextProps, validAttributes) {
462465
continue;
463466
}
464467

465-
if (typeof nextProp === "function") {
466-
nextProp = true;
468+
if (typeof nextProp === 'function') {
469+
nextProp = (true: any);
467470
}
468471

469-
if (typeof attributeConfig !== "object") {
472+
if (typeof attributeConfig !== 'object') {
470473
if (!updatePayload) {
471-
updatePayload = {};
474+
updatePayload = ({}: {[string]: $FlowFixMe});
472475
}
473476
updatePayload[propKey] = nextProp;
474477
continue;
475478
}
476479

477-
if (typeof attributeConfig.process === "function") {
480+
if (typeof attributeConfig.process === 'function') {
478481
if (!updatePayload) {
479-
updatePayload = {};
482+
updatePayload = ({}: {[string]: $FlowFixMe});
480483
}
481484
updatePayload[propKey] = attributeConfig.process(nextProp);
482485
continue;
483486
}
484487

485488
if (isArray(nextProp)) {
486-
for (var i = 0; i < nextProp.length; i++) {
487-
updatePayload = fastAddProperties(updatePayload, nextProp[i], attributeConfig);
489+
for (let i = 0; i < nextProp.length; i++) {
490+
updatePayload = fastAddProperties(
491+
updatePayload,
492+
nextProp[i],
493+
((attributeConfig: any): AttributeConfiguration),
494+
);
488495
}
489496
continue;
490497
}
491498

492-
updatePayload = fastAddProperties(updatePayload, nextProp, attributeConfig);
499+
updatePayload = fastAddProperties(
500+
updatePayload,
501+
nextProp,
502+
((attributeConfig: any): AttributeConfiguration),
503+
);
493504
}
494505

495506
return updatePayload;
@@ -498,7 +509,11 @@ function fastAddProperties(updatePayload, nextProps, validAttributes) {
498509
/**
499510
* addProperties adds all the valid props to the payload after being processed.
500511
*/
501-
function addProperties(updatePayload, props, validAttributes) {
512+
function addProperties(
513+
updatePayload: null | Object,
514+
props: Object,
515+
validAttributes: AttributeConfiguration,
516+
): null | Object {
502517
return fastAddProperties(updatePayload, props, validAttributes);
503518
}
504519

0 commit comments

Comments
 (0)