From 5d39b55de287fb8d97b7df9baedd94cee547409a Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Tue, 18 Oct 2022 21:26:17 +0300 Subject: [PATCH] Changed `mapEnumInput`'s signature --- src/index.ts | 2 +- src/utils/actions/input.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index a5def11..e2ecf36 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,7 +32,7 @@ async function main() { const files = await File.getRequiredFiles(fileSelector); const retryAttempts = mapNumberInput(options.retryAttempts); const retryDelay = mapNumberInput(options.retryDelay); - const failMode = mapEnumInput(options.failMode, FailMode, FailMode.Fail as FailMode); + const failMode = mapEnumInput(options.failMode, FailMode, FailMode.Fail); const publisher = publisherFactory.create(target, logger); const func = { func: () => publisher.publish(files, options), diff --git a/src/utils/actions/input.ts b/src/utils/actions/input.ts index cf39704..1f64623 100644 --- a/src/utils/actions/input.ts +++ b/src/utils/actions/input.ts @@ -90,6 +90,10 @@ function findEnumValueByName, U>(enumClass: T, name: strin return undefined; } +export function mapEnumInput(value: any, enumClass: any, defaultValue?: T): T; + +export function mapEnumInput, U>(value: any, enumClass: T, defaultValue?: U): U; + export function mapEnumInput, U>(value: any, enumClass: T, defaultValue: U = null): U | null { return mapInput(value, defaultValue, { string: (x: string) => {