瀏覽代碼

Upgrade to TypeScript 2.9

Danilo Bargen 7 年之前
父節點
當前提交
02cdb31637
共有 6 個文件被更改,包括 39 次插入69 次删除
  1. 15 15
      package-lock.json
  2. 5 5
      package.json
  3. 5 5
      src/directives/avatar_editor.ts
  4. 7 7
      src/directives/compose_area.ts
  5. 7 7
      src/directives/drag_file.ts
  6. 0 30
      src/types/websocket.d.ts

+ 15 - 15
package-lock.json

@@ -49,9 +49,9 @@
       }
     },
     "@types/angular-translate": {
-      "version": "2.4.35",
-      "resolved": "https://registry.npmjs.org/@types/angular-translate/-/angular-translate-2.4.35.tgz",
-      "integrity": "sha1-GaSDJIZknkktbI1N0F0vwfWDv58=",
+      "version": "2.15.4",
+      "resolved": "https://registry.npmjs.org/@types/angular-translate/-/angular-translate-2.15.4.tgz",
+      "integrity": "sha512-pi+ny3XiHMSLk1r5hCW9rJ5dEFaJfT/+sRS7zcW70A1RW+0F7bnwuxrWzp4rhpJpHe3JiSQktJesZMVV/uOh6g==",
       "requires": {
         "@types/angular": "*"
       }
@@ -70,15 +70,15 @@
       "integrity": "sha1-cUiW9WpI9ki/DFAnPHcaNfNYACc="
     },
     "@types/jasmine": {
-      "version": "2.8.7",
-      "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.8.7.tgz",
-      "integrity": "sha512-RdbrPcW1aD78UmdLiDa9ZCKrbR5Go8PXh6GCpb4oIOkWVEusubSJJDrP4c5RYOu8m/CBz+ygZpicj6Pgms5a4Q==",
+      "version": "2.8.8",
+      "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.8.8.tgz",
+      "integrity": "sha512-OJSUxLaxXsjjhob2DBzqzgrkLmukM3+JMpRp0r0E4HTdT1nwDCWhaswjYxazPij6uOdzHCJfNbDjmQ1/rnNbCg==",
       "dev": true
     },
     "@types/jquery": {
-      "version": "2.0.49",
-      "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-2.0.49.tgz",
-      "integrity": "sha512-/9xLnYmohN/vD2gDnLS4cym8TUmrJu7DvZa/LELKzZjdPsvWVJiedsdu2SXNtb/DA7FGimqL2g0IoyhbNKLl8g=="
+      "version": "3.3.2",
+      "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.3.2.tgz",
+      "integrity": "sha512-ByZwKSEqteAta4VrIalqGJZmMq9lWPD3H3f5Xs6RR8B7zQRDPGUtjoKBYNtKTz/7LgBEQMdlxVbbjQfUaEIItA=="
     },
     "@types/msgpack-lite": {
       "version": "0.1.6",
@@ -7985,9 +7985,9 @@
       }
     },
     "tsify": {
-      "version": "2.0.8",
-      "resolved": "https://registry.npmjs.org/tsify/-/tsify-2.0.8.tgz",
-      "integrity": "sha1-afii/Mcsmqr94HRaBjA53z3nliQ=",
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/tsify/-/tsify-4.0.0.tgz",
+      "integrity": "sha512-A33g5azPh2KDo/gbcSHpSo2m8l5FYC3SdjD5qNpBT+LP758HIGXT6cLko+aJhyFDRU5nCT/zQvfIq/5GQNRsoA==",
       "requires": {
         "convert-source-map": "^1.1.0",
         "fs.realpath": "^1.0.0",
@@ -8148,9 +8148,9 @@
       "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
     },
     "typescript": {
-      "version": "2.6.2",
-      "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.2.tgz",
-      "integrity": "sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q="
+      "version": "2.9.1",
+      "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz",
+      "integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA=="
     },
     "ultron": {
       "version": "1.0.2",

+ 5 - 5
package.json

@@ -32,10 +32,10 @@
     "@types/angular": "^1.6.45",
     "@types/angular-material": "^1.1.59",
     "@types/angular-sanitize": "^1.3.7",
-    "@types/angular-translate": "~2.4.34",
+    "@types/angular-translate": "~2.15.4",
     "@types/angular-ui-router": "^1.1.40",
     "@types/filesaver": "~0.0.30",
-    "@types/jquery": "^2.0.49",
+    "@types/jquery": "^3.3.2",
     "@types/msgpack-lite": "^0.1.6",
     "@types/webrtc": "0.0.23",
     "angular": "~1.5.10",
@@ -63,13 +63,13 @@
     "node-sass": "^4.9.0",
     "sdp": "~1.3.0",
     "ts-events": "^3.1.5",
-    "tsify": "~2.0.1",
+    "tsify": "~4.0.0",
     "tweetnacl": "^1.0.0",
-    "typescript": "~2.6",
+    "typescript": "~2.9",
     "webrtc-adapter": "~3.4.3"
   },
   "devDependencies": {
-    "@types/jasmine": "^2.8.7",
+    "@types/jasmine": "^2.8.8",
     "angular-mocks": "~1.5.10",
     "budo": "^11",
     "concurrently": "~3.3.0",

+ 5 - 5
src/directives/avatar_editor.ts

@@ -103,15 +103,15 @@ export default [
                 function fetchFileContent(file: File): Promise<ArrayBuffer> {
                     return new Promise((resolve, reject) => {
                         const reader = new FileReader();
-                        reader.onload = (ev: Event) => {
-                            resolve((ev.target as FileReader).result);
+                        reader.onload = function(ev: FileReaderProgressEvent) {
+                            resolve(ev.target.result);
                         };
-                        reader.onerror = (ev: ErrorEvent) => {
+                        reader.onerror = function(ev: FileReaderProgressEvent) {
                             // set a null object
                             reject(ev);
                         };
-                        reader.onprogress = function(data) {
-                            if (data.lengthComputable) {
+                        reader.onprogress = function(ev: FileReaderProgressEvent) {
+                            if (ev.lengthComputable) {
                                 // TODO implement progress?
                                 // let progress = ((data.loaded / data.total) * 100);
                             }

+ 7 - 7
src/directives/compose_area.ts

@@ -335,16 +335,16 @@ export default [
                         for (let n = 0; n < fileCounter; n++) {
                             const reader = new FileReader();
                             const file = fileList.item(n);
-                            reader.onload = (ev: Event) => {
-                                next(file, (ev.target as FileReader).result, ev);
+                            reader.onload = function(ev: FileReaderProgressEvent) {
+                                next(file, ev.target.result, ev);
                             };
-                            reader.onerror = (ev: ErrorEvent) => {
+                            reader.onerror = function(ev: FileReaderProgressEvent) {
                                 // set a null object
                                 next(file, null, ev);
                             };
-                            reader.onprogress = function(data) {
-                                if (data.lengthComputable) {
-                                    const progress = ((data.loaded / data.total) * 100);
+                            reader.onprogress = function(ev: FileReaderProgressEvent) {
+                                if (ev.lengthComputable) {
+                                    const progress = ((ev.loaded / ev.total) * 100);
                                     scope.onUploading(true, progress, 100 / fileCounter * n);
                                 }
                             };
@@ -417,7 +417,7 @@ export default [
 
                         // Convert blob to arraybuffer
                         const reader = new FileReader();
-                        reader.onload = function() {
+                        reader.onload = function(progressEvent: FileReaderProgressEvent) {
                             const buffer: ArrayBuffer = this.result;
 
                             // Construct file name

+ 7 - 7
src/directives/drag_file.ts

@@ -47,7 +47,7 @@ export default [
                 function fetchFileListContents(fileList: FileList): Promise<Map<File, ArrayBuffer>> {
                     return new Promise((resolve) => {
                         const buffers = new Map<File, ArrayBuffer>();
-                        const next = (file: File, res: ArrayBuffer | null, error?: ErrorEvent) => {
+                        const next = (file: File, res: ArrayBuffer | null, error?: FileReaderProgressEvent) => {
                             buffers.set(file, res);
                             if (buffers.size >= fileList.length) {
                                 resolve(buffers);
@@ -60,16 +60,16 @@ export default [
                         for (let n = 0; n < fileList.length; n++) {
                             const reader = new FileReader();
                             const file = fileList.item(n);
-                            reader.onload = (ev: Event) => {
-                                next(file, (ev.target as FileReader).result);
+                            reader.onload = function(ev: FileReaderProgressEvent) {
+                                next(file, ev.target.result);
                             };
-                            reader.onerror = (ev: ErrorEvent) => {
+                            reader.onerror = function(ev: FileReaderProgressEvent) {
                                 // set a null object
                                 next(file, null, ev);
                             };
-                            reader.onprogress = function(data) {
-                                if (data.lengthComputable) {
-                                    const progress = ((data.loaded / data.total) * 100);
+                            reader.onprogress = function(ev: FileReaderProgressEvent) {
+                                if (ev.lengthComputable) {
+                                    const progress = ((ev.loaded / ev.total) * 100);
                                     scope.onUploading(true, progress, 100 / fileList.length * n);
                                 }
                             };

+ 0 - 30
src/types/websocket.d.ts

@@ -1,30 +0,0 @@
-// Type definitions for websocket
-// Definitions by: Danilo Bargen <https://github.com/dbrgn>
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-declare const enum ReadyState {
-    Connecting = 0,
-    Open = 1,
-    Closing = 2,
-    Closed = 3,
-}
-
-declare module "websocket" {
-
-    export interface WebSocket {
-        binaryType: string;
-        bufferedAmount: number; // readonly
-        extensions: string;
-        onclose: EventListener;
-        onerror: EventListener;
-        onmessage: EventListener;
-        onopen: EventListener;
-        protocol: string;
-        readyState: ReadyState; // readonly
-        url: string; // readonly
-
-        constructor(url: string, protocols?: string | string[]);
-        close(code?: number, reason?: string);
-        send(data: string | ArrayBuffer | Blob);
-    }
-}