in packages/codegen-ui-react/lib/react-studio-template-renderer.ts [1033:1062]
private buildPropPrecedentStatement(
precedentName: string,
propName: string,
defaultExpression: any,
): VariableStatement {
return factory.createVariableStatement(
undefined,
factory.createVariableDeclarationList(
[
factory.createVariableDeclaration(
factory.createIdentifier(precedentName),
undefined,
undefined,
factory.createConditionalExpression(
factory.createBinaryExpression(
factory.createIdentifier(propName),
factory.createToken(ts.SyntaxKind.ExclamationEqualsEqualsToken),
factory.createIdentifier('undefined'),
),
factory.createToken(ts.SyntaxKind.QuestionToken),
factory.createIdentifier(propName),
factory.createToken(ts.SyntaxKind.ColonToken),
defaultExpression,
),
),
],
ts.NodeFlags.Const,
),
);
}