Throw an error if HttpHypermediaClient cannot initialize its baseUrl attribute default tip
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 07 Jun 2018 15:13:17 +0200
changeset 257 3ebd6a8d8f30
parent 256 46911701ee61
Throw an error if HttpHypermediaClient cannot initialize its baseUrl attribute This is to fix "Property 'baseUrl' has no initializer and is not definitely assigned in the constructor." error with recent (2.7 apparently) typescript version.
src/services/hypermedia.ts
--- a/src/services/hypermedia.ts	Mon Dec 18 18:10:54 2017 +0100
+++ b/src/services/hypermedia.ts	Thu Jun 07 15:13:17 2018 +0200
@@ -28,6 +28,8 @@
             this.baseUrl = SCRIPT_NAME;
         } else if (typeof API_URL !== 'undefined') {
             this.baseUrl = API_URL;
+        } else {
+            throw new Error('Could not determine base URL');
         }
         this.fetch = fetchFunc.bind(window);
     }