Browse Source

fix json parse

Paul 5 years ago
parent
commit
1a8defa4ea
3 changed files with 12 additions and 4 deletions
  1. 2
    1
      src/client.ts
  2. 1
    1
      src/packet.ts
  3. 9
    2
      tsconfig.json

+ 2
- 1
src/client.ts View File

282
                 packet.body = '{}';
282
                 packet.body = '{}';
283
               }
283
               }
284
 
284
 
285
+              this.responseHeader = packet.header;
285
               (<(data: string) => void>this.listeners.get(operator))(
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 View File

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

+ 9
- 2
tsconfig.json View File

1
 {
1
 {
2
   "compileOnSave": true,
2
   "compileOnSave": true,
3
   "compilerOptions": {
3
   "compilerOptions": {
4
+    // Target latest version of ECMAScript.
4
     "target": "es5",
5
     "target": "es5",
6
+    // Search under node_modules for non-relative imports.
5
     "moduleResolution": "node",
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
     "strictNullChecks": true,
15
     "strictNullChecks": true,
7
     "alwaysStrict": true,
16
     "alwaysStrict": true,
8
     "sourceMap": true,
17
     "sourceMap": true,
9
-    "declaration": true,
10
     "rootDirs": [
18
     "rootDirs": [
11
       "src",
19
       "src",
12
       "example"
20
       "example"
13
     ],
21
     ],
14
     "outDir": "lib/",
22
     "outDir": "lib/",
15
-    "declarationDir": "lib/types"
16
   },
23
   },
17
   "include": [
24
   "include": [
18
     "src/**/*",
25
     "src/**/*",