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) => {