需要对jQuery插件样板文件进行哪些修改才能在打字稿中编译?

问题描述:

jQuery plugin boilerplate有一些很棒的jQuery插件开发的启动代码,但是将代码复制并粘贴到打印机中并编译会导致编译失败。需要对jQuery插件样板文件进行哪些修改才能在打字稿中编译?

错误来自undefined参数,它没有被调用(故意使用),所以问题是需要进行哪些修改才能编译它。它可以被删除吗?

制作undefined可选:

// the semi-colon before function invocation is a safety net against concatenated 
// scripts and/or other plugins which may not be closed properly. 
; (function ($ : any, window, document, undefined?) { 

// undefined is used here as the undefined global variable in ECMAScript 3 is 
// mutable (ie. it can be changed by someone else). undefined isn't really being 
// passed in so we can ensure the value of it is truly undefined. In ES5, undefined 
// can no longer be modified. 

这将使该模板编制,因为不确定是不是传递给函数。

+0

完美!谢谢! – djbyter 2013-04-11 14:26:04