printConcrete() — react Function Reference
Architecture documentation for the printConcrete() function in Types.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD c0b647d9_982f_2dc6_de63_c350aa5665d4["printConcrete()"] 912702ee_f06e_77d9_d237_a41c50607cdf["Types.ts"] c0b647d9_982f_2dc6_de63_c350aa5665d4 -->|defined in| 912702ee_f06e_77d9_d237_a41c50607cdf 17f69d0d_e4c0_8640_3524_a834e66c3fee["printUnificationError()"] 17f69d0d_e4c0_8640_3524_a834e66c3fee -->|calls| c0b647d9_982f_2dc6_de63_c350aa5665d4 5b033808_ef9f_1c72_998b_14de0ddb4423["substitute()"] 5b033808_ef9f_1c72_998b_14de0ddb4423 -->|calls| c0b647d9_982f_2dc6_de63_c350aa5665d4 38999144_d544_edc0_6efe_18d9bf834ada["printType()"] 38999144_d544_edc0_6efe_18d9bf834ada -->|calls| c0b647d9_982f_2dc6_de63_c350aa5665d4 083068a4_661f_1478_1674_e6ffb5dd6334["printResolved()"] 083068a4_661f_1478_1674_e6ffb5dd6334 -->|calls| c0b647d9_982f_2dc6_de63_c350aa5665d4 38999144_d544_edc0_6efe_18d9bf834ada["printType()"] c0b647d9_982f_2dc6_de63_c350aa5665d4 -->|calls| 38999144_d544_edc0_6efe_18d9bf834ada d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"] c0b647d9_982f_2dc6_de63_c350aa5665d4 -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6 style c0b647d9_982f_2dc6_de63_c350aa5665d4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Flood/Types.ts lines 194–260
export function printConcrete<T>(
type: ConcreteType<T>,
printType: (_: T) => string,
): string {
switch (type.kind) {
case 'Mixed':
return 'mixed';
case 'Number':
return 'number';
case 'String':
return 'string';
case 'Boolean':
return 'boolean';
case 'Void':
return 'void';
case 'Nullable':
return `${printType(type.type)} | void`;
case 'Array':
return `Array<${printType(type.element)}>`;
case 'Set':
return `Set<${printType(type.element)}>`;
case 'Map':
return `Map<${printType(type.key)}, ${printType(type.value)}>`;
case 'Function': {
const typeParams = type.typeParameters
? `<${type.typeParameters.map(tp => `T${tp}`).join(', ')}>`
: '';
const params = type.params.map(printType).join(', ');
const returnType = printType(type.returnType);
return `${typeParams}(${params}) => ${returnType}`;
}
case 'Component': {
const params = [...type.props.entries()]
.map(([k, v]) => `${k}: ${printType(v)}`)
.join(', ');
const comma = type.children != null && type.props.size > 0 ? ', ' : '';
const children =
type.children != null ? `children: ${printType(type.children)}` : '';
return `component (${params}${comma}${children})`;
}
case 'Generic':
return `T${type.id}`;
case 'Object': {
const name = `Object [${[...type.members.keys()].map(key => JSON.stringify(key)).join(', ')}]`;
return `${name}`;
}
case 'Tuple': {
const name = `Tuple ${type.members}`;
return `${name}`;
}
case 'Structural': {
const name = `Structural ${type.id}`;
return `${name}`;
}
case 'Enum': {
return 'TODO enum printing';
}
case 'Union': {
return type.members.map(printType).join(' | ');
}
case 'Instance': {
return type.name;
}
default:
assertExhaustive(type, `Unknown type: ${JSON.stringify(type)}`);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does printConcrete() do?
printConcrete() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Flood/Types.ts.
Where is printConcrete() defined?
printConcrete() is defined in compiler/packages/babel-plugin-react-compiler/src/Flood/Types.ts at line 194.
What does printConcrete() call?
printConcrete() calls 2 function(s): assertExhaustive, printType.
What calls printConcrete()?
printConcrete() is called by 4 function(s): printResolved, printType, printUnificationError, substitute.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free