Browse Source

chore: Update TypeScript to same version (2.9) for server & admin-ui

Fixes #1
Michael Bromley 7 years ago
parent
commit
8c59c2d5d7

+ 1 - 1
admin-ui/package.json

@@ -69,6 +69,6 @@
     "rimraf": "^2.6.2",
     "ts-node": "~5.0.1",
     "tslint": "~5.10.0",
-    "typescript": "~2.7.2"
+    "typescript": "~2.9.0"
   }
 }

+ 1 - 1
admin-ui/src/app/shared/components/modal-dialog/modal-dialog.component.ts

@@ -43,7 +43,7 @@ export class ModalDialogComponent<T extends Dialog<any>> {
         if (this.options && this.options.locals) {
             // tslint:disable-next-line
             for (const key in this.options.locals) {
-                componentInstance[key] = this.options.locals[key] as T[keyof T];
+                componentInstance[key] = this.options.locals[key] as T[Extract<keyof T, string>];
             }
         }
     }

+ 1 - 5
admin-ui/yarn.lock

@@ -7327,14 +7327,10 @@ typescript@2.4.1:
   version "2.4.1"
   resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.1.tgz#c3ccb16ddaa0b2314de031e7e6fee89e5ba346bc"
 
-"typescript@>=2.6.2 <2.10", typescript@~2.9.1:
+"typescript@>=2.6.2 <2.10", typescript@~2.9.0, typescript@~2.9.1:
   version "2.9.2"
   resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
 
-typescript@~2.7.2:
-  version "2.7.2"
-  resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836"
-
 ua-parser-js@^0.7.18:
   version "0.7.18"
   resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed"

+ 1 - 1
server/package.json

@@ -43,7 +43,7 @@
     "reflect-metadata": "^0.1.12",
     "rxjs": "^6.2.0",
     "typeorm": "^0.2.6",
-    "typescript": "^2.8.0"
+    "typescript": "^2.9.0"
   },
   "devDependencies": {
     "@types/bcrypt": "^2.0.0",

+ 1 - 1
server/yarn.lock

@@ -5244,7 +5244,7 @@ typeorm@^0.2.6:
     yargonaut "^1.1.2"
     yargs "^11.1.0"
 
-typescript@^2.8.0:
+typescript@^2.9.0:
   version "2.9.2"
   resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
 

+ 10 - 1
shared/shared-types.ts

@@ -1,7 +1,16 @@
+// tslint:disable:no-shadowed-variable
 /**
  * A recursive implementation of the Partial<T> type.
+ * Source: https://stackoverflow.com/a/49936686/772859
  */
-export type DeepPartial<T> = { [K in keyof T]?: DeepPartial<T[K]> };
+export type DeepPartial<T> = {
+  [P in keyof T]?: T[P] extends Array<infer U>
+    ? Array<DeepPartial<U>>
+    : T[P] extends ReadonlyArray<infer U>
+      ? ReadonlyArray<DeepPartial<U>>
+      : DeepPartial<T[P]>
+};
+// tslint:enable:no-shadowed-variable
 
 // tslint:disable:ban-types
 /**