ClosureCompiler

Closureで型キャストのやり方。

function makeInstance(clazz) {
  var instance = /**@type {Type}*/(new clazz());
  ....
  return instance;
}

この場合括弧が必要なので注意。

Leave a Reply

Your email address will not be published. Required fields are marked *

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