Search code examples
typescriptopenapi-generator

What does typescript "interface | interface | function" syntax mean?


I am using the openapi-generator-cli with typescirpt-fetch generator to generate models for my application. I am having issues with parts of the generated code that referees to the field that is a polymorphic class. The generated code has an error that reads:

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

I am trying to understand what is causing this. But I am not sure what does code in question even means:

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

Please help.


Solution

  • Sorry, this was an issue with the fetch-typescript generator producing not valid code. There is an open ticket on their github page https://github.com/OpenAPITools/openapi-generator/issues/4626