Improve types in Acp/Ui/Package/QuickInstallation.ts
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 14 Apr 2022 10:20:33 +0000 (12:20 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 14 Apr 2022 10:22:44 +0000 (12:22 +0200)
ts/WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation.js

index 1333ee5645e03c921973fb1342e66881982c4cb9..fe498f1b5b15fd5c18cb9bfc6c9c0eca20ee782f 100644 (file)
@@ -25,9 +25,11 @@ type InstallationCode = {
 type Response =
   | {
       queueID: number;
+      type: "queue";
     }
   | {
       template: string;
+      type: string;
     };
 
 function detectCode(): void {
@@ -75,10 +77,10 @@ async function prepareInstallation(data: InstallationCode): Promise<void> {
     })
     .dispatch()) as Response;
 
-  if ('queueID' in response) {
+  if ("queueID" in response) {
     const installation = new window.WCF.ACP.Package.Installation(response.queueID, undefined, false);
     installation.prepareInstallation();
-  } else if ('template' in response) {
+  } else if ("template" in response) {
     UiDialog.open(
       {
         _dialogSetup() {
@@ -94,7 +96,7 @@ async function prepareInstallation(data: InstallationCode): Promise<void> {
       response.template,
     );
   } else {
-    throw new Error('Unreachable');
+    throw new Error("Unreachable");
   }
 }
 
index 733e03ccff99d291d84e1810bfdd3d2a7713b6a1..e29ab611470451992e6f8df4eaf7139eeaff7c46 100644 (file)
@@ -54,11 +54,11 @@ define(["require", "exports", "tslib", "../../../Ajax", "../../../Core", "../../
             },
         })
             .dispatch());
-        if ('queueID' in response) {
+        if ("queueID" in response) {
             const installation = new window.WCF.ACP.Package.Installation(response.queueID, undefined, false);
             installation.prepareInstallation();
         }
-        else if ('template' in response) {
+        else if ("template" in response) {
             Dialog_1.default.open({
                 _dialogSetup() {
                     return {
@@ -72,7 +72,7 @@ define(["require", "exports", "tslib", "../../../Ajax", "../../../Core", "../../
             }, response.template);
         }
         else {
-            throw new Error('Unreachable');
+            throw new Error("Unreachable");
         }
     }
     function setup() {