【问题标题】:'MapEditServiceConfig' only refers to a type, but is being used as a value here'MapEditServiceConfig' 仅指一种类型,但在此处用作值
【发布时间】:2019-05-22 22:09:44
【问题描述】:

不知道为什么这个错误提示 MapEditServiceConfig ,说 MapEditServiceConfig 指的是一种类型,我们也理解为 MapEditServiceConfig {},因为 MapEditServiceConfig 是一个接口,这个括号说什么?

export interface MapEditServiceConfig extends AppCredentialsConfig {
    readonly "moderation.authServiceId": string;
    readonly "maphub.mc.endpoint": string;
}

export interface AppConfig
    extends MapDataServiceConfig,
        GeocoderConfig,
        LoginServiceConfig,
        ScbeServiceConfig,
        MapJobServiceConfig,
        TaskProviderServiceConfig,
        YourXYZSpaceServiceConfig {

                       "map.defaultLocation":MapDataModels.MapLocation;
            "app.imageBasePath": string;
        },
        MapEditServiceConfig {}  // Getting the refers to a //type , but use as a value here

【问题讨论】:

    标签: javascript typescript


    【解决方案1】:

    AppConfig 扩展的接口列表中有这部分:

     {
       "map.defaultLocation":MapDataModels.MapLocation;
       "app.imageBasePath": string;
    },
    

    编译器将其解释为AppConfig 接口的实际定义。

    逗号是语法错误,编译器需要声明。

    之后是一条新语句MapEditServiceConfig,编译器将其解释为文字值。

    【讨论】:

      猜你喜欢
      • 2018-08-07
      • 2020-04-28
      • 2021-08-23
      • 2020-12-05
      • 2018-03-31
      • 1970-01-01
      • 2023-04-03
      • 2023-04-05
      • 1970-01-01
      相关资源
      最近更新 更多