in src/PageSections/TypeDeclaration.hack [29:62]
public function getTypeDeclaration(ScannedTypeish $t): string {
$code = '';
$ns = $t->getNamespaceName();
if ($ns !== '') {
$code .= 'namespace '.$ns.";\n\n";
}
if ($t is ScannedType) {
$code .= 'type ';
} else {
$code .= 'newtype ';
}
$code .= $t->getShortName();
if ($t is ScannedType) {
$code .= ' = ';
// We want custom multi-line formatting for shapes here, so not calling
// stringify_typehint() for those. Note that we still use the default
// stringify_typehint() for shapes in other places, e.g. as function
// arguments.
$code .= $t->getAliasedType()->isShape()
? _Private\stringify_shape($ns, $t->getAliasedType()->getShapeFields())
: _Private\stringify_typehint(
$t->getNamespaceName(),
$t->getAliasedType(),
);
}
$code .= ';';
return Str\format("```Hack\n%s\n```", $code);
}