in packages/babel-plugin-fbt-runtime/index.js [77:101]
function _buildEnumToHashKeyObjectExpression(
curLevel /*: PatternString | $ReadOnly<TableJSFBTTree> */,
enumsLeft /*: number */,
) /*: BabelNodeObjectExpression */ {
const properties = [];
invariant(typeof curLevel === 'object',
'Expected curLevel to be an object instead of %s', typeof curLevel);
for (const enumKey in curLevel) {
properties.push(
t.objectProperty(
t.identifier(enumKey),
enumsLeft === 1
? t.stringLiteral(fbtHashKey(curLevel[enumKey]))
: _buildEnumToHashKeyObjectExpression(
// TODO(T86653403) Add support for consolidated JSFBT structure to RN
// $FlowFixMe[incompatible-call]
curLevel[enumKey],
enumsLeft - 1,
),
),
);
}
return t.objectExpression(properties);
}