【问题标题】:What does typescript "interface | interface | function" syntax mean?typescript“接口|接口|函数”语法是什么意思?
【发布时间】:2021-06-23 13:03:29
【问题描述】:

我正在使用带有 typecirpt-fetch 生成器的 openapi-generator-cli 来为我的应用程序生成模型。 我对作为多态类的字段的裁判的部分生成代码有问题。 生成的代码有一个错误,内容如下:

TS2693: 'ItineraryButtonDTO' only refers to a type, but is being used as a value here.

我试图了解是什么原因造成的。但我不确定有问题的代码是什么意思:

'buttons': !exists(json, 'buttons') ? undefined : ((json['buttons'] as Array<any>).map(ItineraryButtonDTO | FlightNotificationButtonDTO | ItineraryPayloadButtonDTO | ItineraryPersonaButtonDTOFromJSON)),
        

请帮忙。

【问题讨论】:

    标签: typescript openapi-generator


    【解决方案1】:

    抱歉,这是 fetch-typescript 生成器产生无效代码的问题。 他们的github页面上有一张open ticket https://github.com/OpenAPITools/openapi-generator/issues/4626

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-06-02
      • 2017-09-28
      • 1970-01-01
      • 2022-05-23
      • 1970-01-01
      • 2012-04-22
      • 2011-04-27
      相关资源
      最近更新 更多