Generics 实现无约束的泛型接口时的泛型类型约束

Generics 实现无约束的泛型接口时的泛型类型约束,generics,typescript,resharper,type-constraints,typescript1.6,Generics,Typescript,Resharper,Type Constraints,Typescript1.6,我的问题更多的是关于Resharper TypeScript的支持,您稍后会发现这一点 我的存储库有这样一个通用接口 export interface IRepository<T> { getAll(): IPromise<T[]>; getItem(id: number): IPromise<T>; add(item: T): IPromise<T>; update(item: T): IPromise<T&

我的问题更多的是关于Resharper TypeScript的支持,您稍后会发现这一点

我的存储库有这样一个通用接口

export interface IRepository<T> {
    getAll(): IPromise<T[]>;
    getItem(id: number): IPromise<T>;
    add(item: T): IPromise<T>;
    update(item: T): IPromise<T>;
    deleteItem(item: T): IPromise<T>;
}
我认为这段代码是正确的,因为VisualStudio和TS1.6编译了这段代码。然而,Resharper给我一个错误,你可以在下面找到

我的VS2013 Ultimate使用的是最新的Resharper版本。这仅仅是Resharper的问题还是代码实际上是错误的

这仅仅是Resharper的问题还是代码实际上是错误的

如果您可以运行
tsc-p
,并且没有出现错误,=>则会出现重拾器问题。请注意,resharper有自己的langauge服务实现,与正式的typescript实现不同

除此之外,根据您的代码:

export interface IRepository<T> {
    add(item: T): IPromise<T>;
}
export abstract class BaseHttpRepository<T extends IIdentifyable> implements IRepository<T> {
    // ...
    add(item: T): angular.IPromise<T> {
        // ...
    }
    // ...
}
导出接口IRepository{
添加(项目:T):i推荐;
}
导出抽象类BaseHttpRepository实现IRepository{
// ...
添加(项目:T):angular.IPromise{
// ...
}
// ...
}

对tsc来说应该没问题实际上我希望得到这样的答案。我只是好奇为什么语言的实现可能不同,而语言是官方的。正如我提到的-代码编译良好,当我禁用Resharper时,vanilla VS不会通知我任何错误。我想知道的是,在代码正常的情况下,为什么会出现这样的差异。我想我应该把这个贴在Resharper论坛上,然后大声呼救!:)
export interface IRepository<T> {
    add(item: T): IPromise<T>;
}
export abstract class BaseHttpRepository<T extends IIdentifyable> implements IRepository<T> {
    // ...
    add(item: T): angular.IPromise<T> {
        // ...
    }
    // ...
}