Home / Function/ parseTypeLiteral() — supabase Function Reference

parseTypeLiteral() — supabase Function Reference

Architecture documentation for the parseTypeLiteral() function in Reference.typeSpec.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  d92b9cf8_5353_8348_7da5_f0a2ee5203bc["parseTypeLiteral()"]
  5bbc223c_f2f3_bb5d_0506_1f8279332a2d["parseReflectionType()"]
  5bbc223c_f2f3_bb5d_0506_1f8279332a2d -->|calls| d92b9cf8_5353_8348_7da5_f0a2ee5203bc
  f273b0f2_482b_4163_b404_13bc5e9aca2a["nameOrAnonymous()"]
  d92b9cf8_5353_8348_7da5_f0a2ee5203bc -->|calls| f273b0f2_482b_4163_b404_13bc5e9aca2a
  a2ee5574_56fa_afb2_fc20_7c07cd7a7dba["parseTypeInternals()"]
  d92b9cf8_5353_8348_7da5_f0a2ee5203bc -->|calls| a2ee5574_56fa_afb2_fc20_7c07cd7a7dba
  0ebbf781_9122_475b_4149_017f2ce9e2eb["parseSignature()"]
  d92b9cf8_5353_8348_7da5_f0a2ee5203bc -->|calls| 0ebbf781_9122_475b_4149_017f2ce9e2eb
  ba4cce53_051e_d69f_25a4_55d567b053b3["parseType()"]
  d92b9cf8_5353_8348_7da5_f0a2ee5203bc -->|calls| ba4cce53_051e_d69f_25a4_55d567b053b3
  style d92b9cf8_5353_8348_7da5_f0a2ee5203bc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/docs/Reference.typeSpec.ts lines 893–936

function parseTypeLiteral(
  type: any,
  map: Map<number, any>,
  typeArguments?: any
): TypeDetails | undefined {
  const name = nameOrAnonymous(type)

  if ('children' in type.declaration) {
    const properties = type.declaration.children
      .map((child: any) => parseTypeInternals(child, map, typeArguments))
      .filter(Boolean)
    return {
      name,
      type: 'object',
      properties,
    } satisfies CustomObjectType
  }

  if ('signatures' in type.declaration && type.declaration.signatures[0]) {
    const { params, ret, comment } = parseSignature(type.declaration.signatures[0], map)
    return {
      name,
      type: 'function',
      params,
      ret,
      comment,
    }
  }

  if ('indexSignature' in type.declaration || 'indexSignatures' in type.declaration) {
    const signature = type.declaration.indexSignature ?? type.declaration.indexSignatures[0]

    return {
      name,
      type: 'index signature',
      keyType: signature.parameters?.[0]
        ? parseType(signature.parameters?.[0].type, map)
        : undefined,
      valueType: signature.type ? parseType(signature.type, map) : undefined,
    }
  }

  return undefined
}

Subdomains

Frequently Asked Questions

What does parseTypeLiteral() do?
parseTypeLiteral() is a function in the supabase codebase.
What does parseTypeLiteral() call?
parseTypeLiteral() calls 4 function(s): nameOrAnonymous, parseSignature, parseType, parseTypeInternals.
What calls parseTypeLiteral()?
parseTypeLiteral() is called by 1 function(s): parseReflectionType.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free