TypeScript compiler crash: publicMembers is null or undefined -


the code presented below compiles , executes without error in current form -- however, type declaration of 'getnextasynctasks' on line 19 uncommented compiler crashes following errors:

  1. internal error: unable value of property 'publicmembers': object null or undefined
  2. internal error: intellisense features disabled. try making edits source files restore valid compilation state.
  3. unable value of property 'publicmembers': object null or undefined
  4. the command ""c:\program files (x86)\microsoft sdks\typescript\0.8.0.0\tsc" ... " exited code 1.

while know how avoid in particular case, error keeps occurring silently work on other areas of code base. can quite hard debug since time notice happened have made decent amount of changes , have no hints @ problem might coming time around.

ideally, i'd appreciate if let me know causes crash happen can have better idea of how avoid / work around it.

module abstract {     export interface icallback {         (...args: any[]): any;     }     export interface iasyncop {         (callback: icallback): any;     } }  export class chain {     task : abstract.iasyncop;      constructor(...tasks : abstract.iasyncop[]) {         if (tasks.length === 1)     this.task = tasks[0];         else if (tasks.length > 1)  this.task = cb => this.sync(() => cb.apply(null, arguments), tasks);         else                        this.task = cb => cb();     }      next(getnextasynctasks /*: (...args: any[]) => abstract.iasyncop*/) {         return new chain(             (cb: abstract.icallback) =>                 this.task(                     () => getnextasynctasks.apply(null, arguments)(cb);                 )         );     }      last(cb : abstract.icallback) {         this.task(cb);     }      sync(cb: (...resultargs: iarguments[]) => void, tasks: abstract.iasyncop[]) {         var resultargs : iarguments[] = [], done = 0;          var getcb = (i) => {             return () => {                 resultargs[i] = arguments;                 done++;                  if (done === tasks.length) cb.apply(null, resultargs);             }         };          (var = 0, op; op = tasks[i]; i++) op(getcb(i));     } }  // use example new chain( cb => settimeout(() => cb("foo"), 60)          , cb => settimeout(() => cb("bar"), 10)          ).next((op1, op2) => { console.log(op1, op2)                               ; return cb => settimeout(() => cb(op1[0], op2[0]), 120)                               }          ).next((foo, bar) => { console.log(foo, bar)                               ; return cb => settimeout(() => cb(foo, bar, "baz"), 30)                               }          ).last((foo, bar, baz) => console.log(foo, bar, baz)); 

edit: updated 'next' type signature of param correct.

this looks compiler bug , i'd file report here. tried number of things work around it, none of worked. it's interesting because crash doesn't manifest until try use in example.


Comments