From d64207d27c3c54d345e0c4870e1ba715d212c73c Mon Sep 17 00:00:00 2001 From: Vladimir Date: Fri, 18 Oct 2024 16:35:30 +0500 Subject: [PATCH] fix: Check version --- src/loader.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/loader.ts b/src/loader.ts index aaeac52..e0f5bf3 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -59,9 +59,9 @@ function loadScript(url: string, isExecuted?: () => boolean): Promise { export type IframeApiVersion = 'latest' | `v2.${number}.${number}` | `2.${number}.${number}`; -function normalizeVersion(version: IframeApiVersion): string { - if (version === 'latest' || version[0] === 'v') return version; - return `v${version}`; +function normalizeVersion(version: string): IframeApiVersion { + if (version === 'latest' || version[0] === 'v') return version as IframeApiVersion; + return `v${version}` as IframeApiVersion; } /** @@ -76,7 +76,7 @@ export async function load( if (window.Kinescope?.IframePlayer) { if (typeof version === 'string') { const normVersion = normalizeVersion(version); - const prevVersion = window.Kinescope.IframePlayer.version; + const prevVersion = normalizeVersion(window.Kinescope.IframePlayer.version); const isAnotherVersion = normVersion === 'latest' ? (window.Kinescope.IframePlayer as any).isLatestVersion === false