2017-08-16 15 views
0

我有一個代碼打字稿代碼風格TS2539:不能分配給「的execfile」,因爲它不是一個變量

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); 

當編譯js的

顯示錯誤日誌中這樣

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

我應該改寫代碼以正確的方式解決這個問題,或只是保持ingorne它

+0

導入綁定是不可變的,你不應該試圖修改它們。 – MinusFour

回答

0

設置typescompilerOptions您tsconfig,這樣

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