Skip to content

TypeScript-Fetch generates not compatible code for TypeScript with strictNullChecks mode enabled #4657

@megaboich

Description

@megaboich
Description

When I copy generated client to my project with enabled strictNullChecks I obtain following errors:
error TS2454: Variable 'contentTypeHeader' is used before being assigned.
error TS2345: Argument of type 'FetchAPI | undefined' is not assignable to parameter of type 'FetchAPI'.

Swagger-codegen version

2.2 and 2.3

Swagger declaration file content or url

http://petstore.swagger.io/v2/swagger.json

Command line used for generation

java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l typescript-fetch -o c:\temp\client-tt

Suggest a Fix

I've made a fork with a fix in it:
https://github.com/megaboich/swagger-codegen/commit/0be5faf4071b641bc19148b14767e7601387f027

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions