From 21f34b1e5933505b1d8a1efc4a9bb6c5e5d5820f Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 23 Jul 2018 11:19:13 +0300 Subject: [PATCH] chore: minor typings fix --- src/utils/openapi.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/openapi.ts b/src/utils/openapi.ts index 651df723..0efa0d69 100644 --- a/src/utils/openapi.ts +++ b/src/utils/openapi.ts @@ -21,12 +21,12 @@ export function isStatusCode(statusCode: string) { return statusCode === 'default' || isNumeric(statusCode) || isWildcardStatusCode(statusCode); } -export function getStatusCodeType(statusCode: string, defaultAsError = false): string { +export function getStatusCodeType(statusCode: string | number, defaultAsError = false): string { if (statusCode === 'default') { return defaultAsError ? 'error' : 'success'; } - let code = parseInt(statusCode, 10); + let code = typeof statusCode === 'string' ? parseInt(statusCode, 10) : statusCode; if (isWildcardStatusCode(statusCode)) { code *= 100; // parseInt('2xx') parses to 2 }