2016-10-10 8 views
0
$ grep version node_modules/typescript/package.json 
    "version": "2.0.3" 

$ ./node_modules/.bin/tsc -v 
Version 2.0.3 

$ npm install @types/ws 
[email protected] /Users/zixia/git/wechaty 
└── @types/[email protected] 

$ cat t.ts 
import * as WebSocket from 'ws' 
const ws = new WebSocket('https://api.wechaty.io') 
console.log('ws') 

$ ./node_modules/.bin/tsc --target es6 t.ts 
t.ts(1,28): error TS2307: Cannot find module 'ws'. 

を持つ型/ WS @使用しているとき、私は--target es6なしtscを使用している場合、それは問題なく動作しますmodule`のを見つけることができません。私がそうするなら、私はasync/awaitをもう使用することはできません。`エラーTS2307は:typescriptです2.0

$ ./node_modules/.bin/tsc t.ts # will be ok 

私は何を欠場しましたか?

ところで:ここtypescriptです問題 - https://github.com/Microsoft/TypeScript/issues/11491

答えて

関連する問題