MCPcopy Create free account
hub / github.com/arktypeio/arktype / componentPropsParamOf

Method componentPropsParamOf

ark/aot/graph.ts:3151–3177  ·  view source on GitHub ↗
(
		compFn: FunctionNode,
		compModule: SourceModule
	)

Source from the content-addressed store, hash-verified

3149 }
3150
3151 private componentPropsParamOf(
3152 compFn: FunctionNode,
3153 compModule: SourceModule
3154 ): [type: TSType, context: Node, module: SourceModule] | undefined {
3155 const param = runtimeParamsOf(compFn)[0]
3156 const target = param?.type === "AssignmentPattern" ? param.left : param
3157 if (target && "typeAnnotation" in target && target.typeAnnotation)
3158 return [target.typeAnnotation.typeAnnotation, compFn, compModule]
3159 const declarations = this.declarationsOf(compModule)
3160 if (!declarations) return
3161 const name = exportedFunctionNameOf(compFn, compModule)
3162 if (name === undefined) return
3163 const declParam = declaredParamsOf(declarations, name)?.[0]
3164 const declTarget =
3165 declParam?.type === "AssignmentPattern" ? declParam.left : declParam
3166 if (
3167 declTarget &&
3168 "typeAnnotation" in declTarget &&
3169 declTarget.typeAnnotation
3170 ) {
3171 return [
3172 declTarget.typeAnnotation.typeAnnotation,
3173 declTarget,
3174 declarations
3175 ]
3176 }
3177 }
3178
3179 private jsxComponentOf(
3180 name: Node,

Callers 1

Calls 4

declarationsOfMethod · 0.95
runtimeParamsOfFunction · 0.90
exportedFunctionNameOfFunction · 0.85
declaredParamsOfFunction · 0.85

Tested by

no test coverage detected