0

我使用 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 : ""; 
    }
4

1 回答 1

0

如果您使用 NSwagStudio,请检查您是否不小心在“模块名称”字段中添加了某些内容。

于 2021-01-15T14:10:32.987 回答