()
| 177 | } |
| 178 | |
| 179 | const 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 | |
| 207 | if (values.declare && !values.emit) { |
| 208 | const others = Object.keys(values).filter( |
no test coverage detected