我使用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 : "";
}
答案 0 :(得分:0)
如果您使用过 NSwagStudio,请检查您是否不小心在“模块名称”字段中输入了某些内容。