From 6da4c6d42e8a521f80c81c8c1911fa533f9adc67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0t=C4=9Bp=C3=A1nek?= Date: Fri, 27 Jan 2023 13:39:03 +0100 Subject: [PATCH 1/3] Add the DotvvmGlobalExtensions interface --- src/Framework/Framework/Resources/Scripts/dotvvm-root.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts b/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts index b9096d3777..edc9d8976e 100644 --- a/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts +++ b/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts @@ -132,8 +132,12 @@ if (compileConstants.debug) { (dotvvmExports as any).debug = true } + + declare global { - const dotvvm: typeof dotvvmExports & {debug?: true, isSpaReady?: typeof isSpaReady, handleSpaNavigation?: typeof handleSpaNavigation}; + interface DotvvmGlobalExtensions {} + + const dotvvm: DotvvmGlobalExtensions & typeof dotvvmExports & {debug?: true, isSpaReady?: typeof isSpaReady, handleSpaNavigation?: typeof handleSpaNavigation}; interface Window { dotvvm: typeof dotvvmExports From cf2cb8008ba84ebbac1b649899216eb80657fa60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0t=C4=9Bp=C3=A1nek?= Date: Fri, 27 Jan 2023 13:49:11 +0100 Subject: [PATCH 2/3] Add one more reference to DotvvmGlobalExtensions --- src/Framework/Framework/Resources/Scripts/dotvvm-root.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts b/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts index edc9d8976e..558e247ee8 100644 --- a/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts +++ b/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts @@ -140,7 +140,7 @@ declare global { const dotvvm: DotvvmGlobalExtensions & typeof dotvvmExports & {debug?: true, isSpaReady?: typeof isSpaReady, handleSpaNavigation?: typeof handleSpaNavigation}; interface Window { - dotvvm: typeof dotvvmExports + dotvvm: DotvvmGlobalExtensions & typeof dotvvmExports } } From a263c47d8d51339073a4a57853a0c7728415b72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Standa=20Luke=C5=A1?= Date: Wed, 1 Feb 2023 18:42:56 +0100 Subject: [PATCH 3/3] `const dotvvm` and `window.dotvvm` should have the same type --- src/Framework/Framework/Resources/Scripts/dotvvm-root.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts b/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts index 558e247ee8..6e3f98028c 100644 --- a/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts +++ b/src/Framework/Framework/Resources/Scripts/dotvvm-root.ts @@ -136,11 +136,12 @@ if (compileConstants.debug) { declare global { interface DotvvmGlobalExtensions {} + type DotvvmGlobal = DotvvmGlobalExtensions & typeof dotvvmExports & { debug?: true, isSpaReady?: typeof isSpaReady, handleSpaNavigation?: typeof handleSpaNavigation } - const dotvvm: DotvvmGlobalExtensions & typeof dotvvmExports & {debug?: true, isSpaReady?: typeof isSpaReady, handleSpaNavigation?: typeof handleSpaNavigation}; + const dotvvm: DotvvmGlobal; interface Window { - dotvvm: DotvvmGlobalExtensions & typeof dotvvmExports + dotvvm: DotvvmGlobal } }