小编han*_*ans的帖子

typescript变量函数接口定义0.9.5中的参数数量

我有这个场景,文件是t.ts:

interface Itest{
   (event: any, ...args: any[]):any;
   }

   var t1: Itest = function (testparam) { return true;};
   var t2: Itest = function (testparam, para1) { return true; };
   var t3: Itest = function (testparam, para1, para2) { return true; };


   interface Itest2 {
     (event: any, para1,...args: any[]): any;
   }
   var t4: Itest2 = function (testparam, para1) { return true; };
   var t5: Itest2 = function (testparam, para1, para2) { return true; };
Run Code Online (Sandbox Code Playgroud)

当我用tsc 0.9.5编译它时,我得到以下错误:

tsc --target ES5  "t.ts"  
t.ts(6,8): error …
Run Code Online (Sandbox Code Playgroud)

typescript

10
推荐指数
1
解决办法
8700
查看次数

标签 统计

typescript ×1