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

Method declarationsOf

ark/aot/graph.ts:2664–2676  ·  view source on GitHub ↗
(module: SourceModule)

Source from the content-addressed store, hash-verified

2662
2663 // the .d.ts beside a JS module, where its build wrote one
2664 private declarationsOf(module: SourceModule): SourceModule | undefined {
2665 if (!/\.[cm]?jsx?$/.test(module.id)) return
2666 const id = module.id.replace(/\.([cm]?)jsx?$/, ".d.$1ts")
2667 let declarations = this.declarationsById[id]
2668 if (declarations === undefined) {
2669 const source = this.host.readFile(id)
2670 declarations = this.declarationsById[id] =
2671 source === undefined ? null : (
2672 new SourceModule(id, source, this.pathOf(id))
2673 )
2674 }
2675 return declarations ?? undefined
2676 }
2677
2678 // a type literal or interface isn't a Type, though a member typed
2679 // `unknown` may hold one, which reads off it are as off a parameter

Callers 3

declaredParamKindOfMethod · 0.95
findExportedTypeMethod · 0.95
componentPropsParamOfMethod · 0.95

Calls 4

pathOfMethod · 0.95
testMethod · 0.80
replaceMethod · 0.80
readFileMethod · 0.80

Tested by

no test coverage detected