Home / Function/ extractParamTypeAsString() — supabase Function Reference

extractParamTypeAsString() — supabase Function Reference

Architecture documentation for the extractParamTypeAsString() function in helpers.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  4d714e29_17f3_63d7_6bcd_26610b82f16c["extractParamTypeAsString()"]
  6f8bb888_f260_e3d0_0f56_7e5048c6953c["generateLabelParam()"]
  6f8bb888_f260_e3d0_0f56_7e5048c6953c -->|calls| 4d714e29_17f3_63d7_6bcd_26610b82f16c
  style 4d714e29_17f3_63d7_6bcd_26610b82f16c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/lib/refGenerator/helpers.ts lines 152–189

function extractParamTypeAsString(paramDefinition) {
  if (paramDefinition.type?.name) {
    // return `<code>${paramDefinition.type.name}</code>` // old
    return paramDefinition.type.name
  } else if (paramDefinition.type?.type === 'union') {
    // only do this for literal/primitive types - for complex objects we just return 'object'
    if (paramDefinition.type.types.every(({ type }) => ['literal', 'intrinsic'].includes(type))) {
      return paramDefinition.type.types
        .map((x) => {
          if (x.type === 'literal') {
            if (typeof x.value === 'string') {
              return `"${x.value}"`
            }
            return `${x.value}`
          } else if (x.type === 'intrinsic') {
            if (x.name === 'unknown') {
              return 'any'
            }
            return x.name
          }
        })
        .join(' | ')
    }
  } else if (paramDefinition.type?.type === 'array') {
    const elementType = paramDefinition.type.elementType

    if (elementType.type === 'intrinsic') {
      if (elementType.name === 'unknown') {
        return 'any[]'
      }
      return `${elementType.name}[]`
    }

    return 'object[]'
  }

  return 'object' // old '<code>object</code>'
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free