浏览代码

fix json parse

Paul 5 年前
父节点
当前提交
1a8defa4ea
共有 3 个文件被更改,包括 12 次插入4 次删除
  1. 2
    1
      src/client.ts
  2. 1
    1
      src/packet.ts
  3. 9
    2
      tsconfig.json

+ 2
- 1
src/client.ts 查看文件

@@ -282,8 +282,9 @@ class Client {
282 282
                 packet.body = '{}';
283 283
               }
284 284
 
285
+              this.responseHeader = packet.header;
285 286
               (<(data: string) => void>this.listeners.get(operator))(
286
-                packet.body,
287
+                JSON.parse(packet.body),
287 288
               );
288 289
             }
289 290
 

+ 1
- 1
src/packet.ts 查看文件

@@ -1,5 +1,5 @@
1 1
 import { Utils } from './utils';
2
-import Int64 = require('node-int64');
2
+import Int64 from 'node-int64';
3 3
 
4 4
 export class Packet {
5 5
   private key: string = 'b8ca9aa66def05ff3f24919274bb4a66';

+ 9
- 2
tsconfig.json 查看文件

@@ -1,18 +1,25 @@
1 1
 {
2 2
   "compileOnSave": true,
3 3
   "compilerOptions": {
4
+    // Target latest version of ECMAScript.
4 5
     "target": "es5",
6
+    // Search under node_modules for non-relative imports.
5 7
     "moduleResolution": "node",
8
+    // Process & infer types from .js files.
9
+    "allowJs": true,
10
+    // Don't emit; allow Babel to transform files.
11
+    "noEmit": true,
12
+    // Import non-ES modules as default imports.
13
+    "esModuleInterop": true,
14
+    // Enable strictest settings like strictNullChecks & noImplicitAny.
6 15
     "strictNullChecks": true,
7 16
     "alwaysStrict": true,
8 17
     "sourceMap": true,
9
-    "declaration": true,
10 18
     "rootDirs": [
11 19
       "src",
12 20
       "example"
13 21
     ],
14 22
     "outDir": "lib/",
15
-    "declarationDir": "lib/types"
16 23
   },
17 24
   "include": [
18 25
     "src/**/*",