formatTypeForSignature() — supabase Function Reference
Architecture documentation for the formatTypeForSignature() function in Reference.typeSpec.ts from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/docs/features/docs/Reference.typeSpec.ts lines 1033–1066
function formatTypeForSignature(type: TypeDetails | undefined): string {
if (!type) return 'any'
switch (type.type) {
case 'intrinsic':
return type.name !== TYPESPEC_NODE_ANONYMOUS ? (type.name as string) : 'any'
case 'literal':
if ('value' in type) {
return type.value === null ? 'null' : `"${type.value}"`
}
return type.name !== TYPESPEC_NODE_ANONYMOUS ? (type.name as string) : 'any'
case 'nameOnly':
return type.name !== TYPESPEC_NODE_ANONYMOUS ? (type.name as string) : 'any'
case 'promise':
return `Promise<${formatTypeForSignature(type.awaited)}>`
case 'array':
return `${formatTypeForSignature(type.elemType)}[]`
case 'object':
return type.name !== TYPESPEC_NODE_ANONYMOUS ? (type.name as string) : 'object'
case 'function':
return 'Function'
case 'union':
if (type.subTypes && type.subTypes.length > 0) {
return type.subTypes.map((st) => formatTypeForSignature(st)).join(' | ')
}
return 'any'
case 'record':
return `Record<${formatTypeForSignature(type.keyType)}, ${formatTypeForSignature(type.valueType)}>`
case 'index signature':
return `{ [key: ${formatTypeForSignature(type.keyType)}]: ${formatTypeForSignature(type.valueType)} }`
default:
return 'any'
}
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free