【问题标题】:Module has no exported member模块没有导出成员
【发布时间】:2016-12-05 23:17:21
【问题描述】:

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

【问题讨论】:

  • 看到一个拥有 1.6k 代表的用户发布 代码图片,真是令人失望。
  • @jonrsharpe,根据您的建议更新了我的问题 :)

标签: angular swagger swagger-codegen


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2017-05-20
    • 2017-05-07
    • 2017-08-18
    • 1970-01-01
    • 2017-09-09
    • 2022-01-12
    • 2021-12-19
    • 2017-03-27
    相关资源
    最近更新 更多