Skip to content

[typescript-angular] error TS1345: An expression of type 'void' cannot be tested for truthiness #8836

@itsTeknas

Description

@itsTeknas
Description

The generated typescript client fails in angular 7 build when there seems to be any sort of file field.

Typescript version

"typescript": "^3.1.3"

Swagger-codegen version

The latest online version

Swagger declaration file content or url
parameters:
        - name: attachment1
          type: file
          in: formData
          required: false

Produces:

if (attachment1 !== undefined) {
            formParams = formParams.append('attachment1', <any>attachment1) || formParams;
}

The definition of append tracks down to

let formParams: { append(param: string, value: any): void; };

screenshot 2018-10-22 at 2 13 46 pm

Steps to reproduce

Generate a new client with angular-typescript selected.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions