强制通用打字稿警告

时间:2019-06-03 05:59:29

标签: typescript

我有此代码:

class testClass1 {
    public a : number = 1;
};

class testClass2 {
    public b : number = 2;
};

interface InterfaceTest<A,T> {(a : A) : T};

function wrapper<A,B>(func : InterfaceTest<A,B>) {
    return 0;
}

wrapper<testClass1, testClass2>(implementation);
wrapper(implementation);

这两个对包装器的调用都没有警告,但是我希望第二个包装器调用产生警告,因为没有将类型赋予函数调用。

我该如何实现?

0 个答案:

没有答案
相关问题