Skip to content

Generated code does not seem to compile #6

Closed
@inthegarage

Description

@inthegarage

In the generated file DefaultAPI.ts I am getting quite a few errors regarding the instance of check. For instance:

    if (contentPackageId !== undefined) {
        if(contentPackageId instanceof Date) {

Is generated for my yaml file and yet when an attempt to compile this I get:

[INFO] ERROR in src/app/api/DefaultApi.ts (353,16): The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
[INFO] src/app/api/DefaultApi.ts (354,79): Property 'd' does not exist on type 'string & Date'.

There are several of these in the file generally regarding a passed in parameter and a check around that parameter to see if it is of type 'Date'.
I have seen the following issue reported here, but that seems very out of date and resolved a long time ago:

microsoft/TypeScript#2775

As this is generated code, how can I effect the operation and get the code to compile successfully?
I'm using swagger-codegen 2.2.2 maven plugin, with setting:
typescript-angular2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions