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

Function typeParameterOf

ark/aot/graph.ts:6560–6579  ·  view source on GitHub ↗
(
	context: TypeContext | null | undefined,
	name: string
)

Source from the content-addressed store, hash-verified

6558}
6559
6560const typeParameterOf = (
6561 context: TypeContext | null | undefined,
6562 name: string
6563): TSTypeParameter | undefined => {
6564 if (!context) return
6565 if ("node" in context) {
6566 return (
6567 ("typeParameters" in context.node &&
6568 context.node.typeParameters?.params.find(
6569 param => param.name.name === name
6570 )) ||
6571 typeParameterOf(context.parent, name)
6572 )
6573 }
6574 return (
6575 ("typeParameters" in context &&
6576 context.typeParameters?.params.find(param => param.name.name === name)) ||
6577 typeParameterOf(context.parent, name)
6578 )
6579}
6580
6581const castOf = (node: Node): Node | undefined => {
6582 for (; isTransparent(node); node = node.expression) {

Callers 3

namedTypeKindOfMethod · 0.85
propTypesOfMethod · 0.85

Calls 1

findMethod · 0.80

Tested by

no test coverage detected