我使用 Swagger 生成客户端存根(调用 API),这部分很好。当我尝试在组件中导入类时出现错误Module has no member of ...
import { CollaborationClient } from './../../shared/web-api-client';
在上述声明中出错。
web-api-client.ts
(由 Swagger 生成的文件)具有 CollaborationClient 如下
export interface ICollaborationClient {
get(): Observable<any>;
updateCollaborationInfo(collaboration: CollaborationViewModel): Observable<any>;
createCollaboration(collaboration: CollaborationViewModel): Observable<any>;
removeCollaborationMember(collaboration: CollaborationViewModel): Observable<any>;
put(id: number, member: UserViewModel): Observable<any>;
delete(id: number): Observable<any>;
}
@Injectable()
export class CollaborationClient implements ICollaborationClient {
private http: Http = null;
private baseUrl: string = undefined;
protected jsonParseReviver: (key: string, value: any) => any = undefined;
constructor(@Inject(Http) http: Http, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {
this.http = http;
this.baseUrl = baseUrl ? baseUrl : "";
}