Home / Function/ parseConditionalType() — supabase Function Reference

parseConditionalType() — supabase Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  646c7617_33a5_8c5a_0a94_60c585380205["parseConditionalType()"]
  ba4cce53_051e_d69f_25a4_55d567b053b3["parseType()"]
  ba4cce53_051e_d69f_25a4_55d567b053b3 -->|calls| 646c7617_33a5_8c5a_0a94_60c585380205
  ba4cce53_051e_d69f_25a4_55d567b053b3["parseType()"]
  646c7617_33a5_8c5a_0a94_60c585380205 -->|calls| ba4cce53_051e_d69f_25a4_55d567b053b3
  style 646c7617_33a5_8c5a_0a94_60c585380205 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/docs/Reference.typeSpec.ts lines 657–692

function parseConditionalType(
  type: any,
  map: Map<number, any>,
  typeArguments?: any,
  _debug = false
) {
  if (type.extendsType?.type === 'intrinsic' && type.extendsType?.name === 'object') {
    let properties = []

    if (
      type.trueType?.type === 'mapped' &&
      type.trueType?.parameterType?.target?.refersToTypeParameter &&
      typeArguments?.[0]
    ) {
      const propertyNames = parseType(typeArguments?.[0], map).properties?.map((p) => p.name)
      properties = (propertyNames ?? [])
        .map((p: string) => {
          if (!type.trueType?.templateType) return undefined

          const mappedType = parseType(type.trueType.templateType, map)
          if (mappedType) {
            return {
              name: p,
              type: mappedType,
            }
          }
        })
        .filter(Boolean)
    }

    return {
      type: 'object',
      properties,
    }
  }
}

Subdomains

Calls

Called By

Frequently Asked Questions

What does parseConditionalType() do?
parseConditionalType() is a function in the supabase codebase.
What does parseConditionalType() call?
parseConditionalType() calls 1 function(s): parseType.
What calls parseConditionalType()?
parseConditionalType() is called by 1 function(s): parseType.

Analyze Your Own Codebase

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

Try Supermodel Free