diff --git a/source/commands/utils/sharedDangerfileArgs.ts b/source/commands/utils/sharedDangerfileArgs.ts index 1931714ec..e8c3410c0 100644 --- a/source/commands/utils/sharedDangerfileArgs.ts +++ b/source/commands/utils/sharedDangerfileArgs.ts @@ -1,12 +1,12 @@ -import program from "commander" +import { Command } from "commander" import chalk from "chalk" -process.on("unhandledRejection", function(reason: string, _p: any) { +process.on("unhandledRejection", function (reason: string, _p: any) { console.log(chalk.red("Error: "), reason) process.exitCode = 1 }) -export interface SharedCLI extends program.CommanderStatic { +export interface SharedCLI extends Command { /** Should we be posting as much info as possible? */ verbose: boolean /** Output to STDOUT instead of leaving a comment */ diff --git a/source/runner/dslGenerator.ts b/source/runner/dslGenerator.ts index bb0c7c54a..d06eeb043 100644 --- a/source/runner/dslGenerator.ts +++ b/source/runner/dslGenerator.ts @@ -3,12 +3,12 @@ import { DangerDSLJSONType } from "../dsl/DangerDSL" import { CliArgs } from "../dsl/cli-args" import { CISource } from "../ci_source/ci_source" import { emptyGitJSON } from "../platforms/github/GitHubGit" -import { CommanderStatic } from "commander" +import { Command } from "commander" export const jsonDSLGenerator = async ( platform: Platform, source: CISource, - program: CommanderStatic + program: Command ): Promise => { const useSimpleDSL = platform.getPlatformReviewSimpleRepresentation && source.useEventDSL @@ -27,7 +27,7 @@ export const jsonDSLGenerator = async ( id: program.id, textOnly: program.textOnly, verbose: program.verbose, - staging: program.staging + staging: program.staging, } const dslPlatformName = jsonDSLPlatformName(platform) diff --git a/source/runner/jsonToContext.ts b/source/runner/jsonToContext.ts index ad3a5ceb6..cd538cc19 100644 --- a/source/runner/jsonToContext.ts +++ b/source/runner/jsonToContext.ts @@ -3,7 +3,7 @@ import { jsonToDSL } from "./jsonToDSL" import { contextForDanger, DangerContext } from "./Dangerfile" import { DangerDSLJSON } from "./dangerDSLJSON" import { CISource } from "../ci_source/ci_source" -import { CommanderStatic } from "commander" +import { Command } from "commander" /** * Reads in the JSON string converts to a dsl object and gets the change context @@ -12,12 +12,8 @@ import { CommanderStatic } from "commander" * @param program {any} commander * @returns {Promise} context for danger */ -export async function jsonToContext( - JSONString: string, - program: CommanderStatic, - source: CISource -): Promise { - const dslJSON = { danger: new DangerDSLJSON(JSONString, (program as any) as CliArgs) } +export async function jsonToContext(JSONString: string, program: Command, source: CISource): Promise { + const dslJSON = { danger: new DangerDSLJSON(JSONString, program as any as CliArgs) } const dsl = await jsonToDSL(dslJSON.danger, source) return contextForDanger(dsl) }