環境
npm list -g typescript
/Users/yuta/.nodebrew/node/v10.17.0/lib
└── typescript@3.8.3
tsc --version
Version 3.8.3
怒られた
function waite(duration: number) {
return new Promise(resolve => {
setTimeout(()=> resolve(`${duration} ms passed`), duration)
})
}
waite(100).then((result) => {}) //resは{}
'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later
参考: https://qiita.com/k_hoso/items/a8b9de1f5f6b2b93b4f7#%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E3%81%99%E3%82%8B%E3%81%A8ts2580%E3%81%8C%E5%87%BA%E3%82%8Bdo-you-need-to-install-type-definitions-for-node
直した
npm list -g typescript
/Users/yuta/.nodebrew/node/v10.17.0/lib
└── typescript@3.8.3
直った!!!