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

Method localTypeOf

ark/aot/graph.ts:3555–3573  ·  view source on GitHub ↗
(
		module: SourceModule,
		name: string
	)

Source from the content-addressed store, hash-verified

3553
3554 // e.g. `type Schemas = { user: Type }`, unless the module declares two
3555 private localTypeOf(
3556 module: SourceModule,
3557 name: string
3558 ): LocalType | undefined {
3559 let types = this.localTypesByModule.get(module)
3560 if (!types) {
3561 const found: Record<string, LocalType | null> = Object.create(null)
3562 walk(module.program, node => {
3563 if (
3564 node.type === "TSInterfaceDeclaration" ||
3565 node.type === "TSTypeAliasDeclaration"
3566 )
3567 found[node.id.name] = node.id.name in found ? null : node
3568 return true
3569 })
3570 this.localTypesByModule.set(module, (types = found))
3571 }
3572 return types[name] ?? undefined
3573 }
3574
3575 // e.g. `f(A)`, `(t => t)(A)` or `new C(A)` for C's constructor; undefined if `f` escapes
3576 callsOf(

Callers 3

namedTypeKindOfMethod · 0.95
findExportedTypeMethod · 0.95
propTypesOfMethod · 0.95

Calls 3

walkFunction · 0.90
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected