convertFlowType() — react Function Reference
Architecture documentation for the convertFlowType() function in Types.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 25b31b43_6836_a603_053e_6e3ab2e0e8ee["convertFlowType()"] 912702ee_f06e_77d9_d237_a41c50607cdf["Types.ts"] 25b31b43_6836_a603_053e_6e3ab2e0e8ee -->|defined in| 912702ee_f06e_77d9_d237_a41c50607cdf e3d1f312_c52c_8d71_91e3_cec13c53ceb5["init()"] e3d1f312_c52c_8d71_91e3_cec13c53ceb5 -->|calls| 25b31b43_6836_a603_053e_6e3ab2e0e8ee 2c4e753a_89e2_549e_c944_098fbbb639b5["makeTypeParameterId()"] 25b31b43_6836_a603_053e_6e3ab2e0e8ee -->|calls| 2c4e753a_89e2_549e_c944_098fbbb639b5 383c6e01_ae92_37d0_4770_0bf1d393335e["unsupportedTypeAnnotation()"] 25b31b43_6836_a603_053e_6e3ab2e0e8ee -->|calls| 383c6e01_ae92_37d0_4770_0bf1d393335e style 25b31b43_6836_a603_053e_6e3ab2e0e8ee fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Flood/Types.ts lines 281–648
function convertFlowType(flowType: FlowType, loc: string): ResolvedType {
let nextGenericId = 0;
function convertFlowTypeImpl(
flowType: FlowType,
loc: string,
genericEnv: Map<string, TypeParameterId>,
platform: Platform,
poly: null | Array<TypeParameter<ResolvedType>> = null,
): ResolvedType {
switch (flowType.kind) {
case 'TypeApp': {
if (
flowType.type.kind === 'Def' &&
flowType.type.def.kind === 'Poly' &&
flowType.type.def.t_out.kind === 'Def' &&
flowType.type.def.t_out.def.kind === 'Type' &&
flowType.type.def.t_out.def.type.kind === 'Opaque' &&
flowType.type.def.t_out.def.type.opaquetype.opaque_name ===
'Client' &&
flowType.targs.length === 1
) {
return convertFlowTypeImpl(
flowType.targs[0],
loc,
genericEnv,
'client',
);
} else if (
flowType.type.kind === 'Def' &&
flowType.type.def.kind === 'Poly' &&
flowType.type.def.t_out.kind === 'Def' &&
flowType.type.def.t_out.def.kind === 'Type' &&
flowType.type.def.t_out.def.type.kind === 'Opaque' &&
flowType.type.def.t_out.def.type.opaquetype.opaque_name ===
'Server' &&
flowType.targs.length === 1
) {
return convertFlowTypeImpl(
flowType.targs[0],
loc,
genericEnv,
'server',
);
}
return Resolved.todo(platform);
}
case 'Open':
return Resolved.mixed(platform);
case 'Any':
return Resolved.todo(platform);
case 'Annot':
return convertFlowTypeImpl(
flowType.type,
loc,
genericEnv,
platform,
poly,
);
case 'Opaque': {
if (
flowType.opaquetype.opaque_name === 'Client' &&
flowType.opaquetype.super_t != null
) {
return convertFlowTypeImpl(
flowType.opaquetype.super_t,
loc,
genericEnv,
'client',
);
}
if (
flowType.opaquetype.opaque_name === 'Server' &&
flowType.opaquetype.super_t != null
) {
return convertFlowTypeImpl(
flowType.opaquetype.super_t,
loc,
genericEnv,
'server',
);
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does convertFlowType() do?
convertFlowType() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Flood/Types.ts.
Where is convertFlowType() defined?
convertFlowType() is defined in compiler/packages/babel-plugin-react-compiler/src/Flood/Types.ts at line 281.
What does convertFlowType() call?
convertFlowType() calls 2 function(s): makeTypeParameterId, unsupportedTypeAnnotation.
What calls convertFlowType()?
convertFlowType() is called by 1 function(s): init.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free