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

Function declare

ark/aot/cli.ts:179–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

177}
178
179const declare = (): never => {
180 const checker = values.checker as string | undefined
181 if (checker !== undefined && !checkers.includes(checker as Checker))
182 fail(`--checker must be ${checkers.join(", ")} (was ${checker})`)
183 const cwd = values.cwd as string | undefined
184 // a flag over ark.json, as for the other modes
185 const { tsconfig, checker: setChecker } = ((): DeclareOptions => {
186 try {
187 return withSettingsFile({
188 cwd,
189 tsconfig: values.tsconfig as string | undefined,
190 checker: checker as Checker | undefined
191 })
192 } catch (e) {
193 return failSettings(e)
194 }
195 })()
196 const declarations = run(() =>
197 emitDeclarations({ cwd, tsconfig, checker: setChecker })
198 )
199 writeFiles(declarations.files)
200 if (declarations.diagnostics) console.error(declarations.diagnostics)
201 console.log(
202 `${Object.keys(declarations.files).length} declaration files in ${relative(process.cwd(), declarations.root) || "."}, with ${countOf(declarations.shapes, "shape")} in ${sharedDeclarationFile}`
203 )
204 process.exit(declarations.errors ? 1 : 0)
205}
206
207if (values.declare && !values.emit) {
208 const others = Object.keys(values).filter(

Callers 9

cli.tsFile · 0.70
arktype.tsFile · 0.50
bakedMembersOfMethod · 0.50
declareMethod · 0.50
readMethod · 0.50
type.test.tsFile · 0.50
declared.test.tsFile · 0.50
operator.bench.tsFile · 0.50
mapped.test.tsFile · 0.50

Calls 8

withSettingsFileFunction · 0.90
failSettingsFunction · 0.85
emitDeclarationsFunction · 0.85
writeFilesFunction · 0.85
failFunction · 0.70
runFunction · 0.70
countOfFunction · 0.70
errorMethod · 0.45

Tested by

no test coverage detected