typescript code style TS2539:Cannot assign to 'execFile' because it is not a variable

匿名 (未验证) 提交于 2019-12-03 01:40:02

问题:

I have a code

import * as path from 'path'; import * as globby from 'globby'; import { execFile } from 'child_process'; import * as util from 'util'; //import * as Promise from 'bluebird'; import * as fs from 'fs';  execFile = util.promisify(execFile); 

when it compiler to js

show error log like this

Error:(12, 1) TS2539:Cannot assign to 'execFile' because it is not a variable. 

what should i rewrite code for fix this in right way, or just keep ingorne it

回答1:

Setting up types for your tsconfig in compilerOptions, like this

"compilerOptions": {     "target": "es5",     "lib": [ "es2015"],     "types": ["node"],     "module": "commonjs"   } 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!