Gulp TypeScript build error : TypeError: Cannot read property ‘length’ of undefined at Object.emit [as writeFile] gulp-typescript\release\compiler.js

At work we use a TS “native” approach with tsconfig.json settings and running tsc compiler approach + gulp-typescript with some tuned building pipelines and some logic. We switched on incremental builds and we liked it, but it seems that while this worked side by side with TS +- 3.5.3, having set

incremental: true

in tsconfig.json and having TS 3.6.3 will result in error like this :

TypeError: Cannot read property 'length' of undefined
    at Object.emit [as writeFile] (/path/here/node_modules/gulp-typescript/release/compiler.js:81:33)

so either you will turn off the setting in tsconfig.json file or tweak it in gulpfile like here : https://github.com/ivogabe/gulp-typescript

var tsProject = ts.createProject('tsconfig.json', { noImplicitAny: true, incremental: false });

Credits go to these guys here, thx :
http://quabr.com/58031957/typescript-throws-a-cannot-read-property-length-of-undefined-when-run-throug

0 comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.