The typescript-node generated client has an issue with strict class initialisation. See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html section 'Strict Class Initialization'. The generator generates various authentication types (HttpBasicAuth, ApiKeyAuth, ...) which cause typescript transpilation to fail with:
typescript-node/api.ts(877,12): error TS2564: Property 'username' has no initializer and is not definitely assigned in the constructor.
typescript-node/api.ts(878,12): error TS2564: Property 'password' has no initializer and is not definitely assigned in the constructor.
typescript-node/api.ts(887,12): error TS2564: Property 'apiKey' has no initializer and is not definitely assigned in the constructor.
typescript-node/api.ts(902,12): error TS2564: Property 'accessToken' has no initializer and is not definitely assigned in the constructor.
typescript-node/api.ts(912,12): error TS2564: Property 'username' has no initializer and is not definitely assigned in the constructor.
typescript-node/api.ts(913,12): error TS2564: Property 'password' has no initializer and is not definitely assigned in the constructor.
2.4.0-SNAPSHOT
petstore.yaml
swagger-codegen generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-node -o samples/client/petstore/typescript-node/default"
--strictPropertyInitialization enabled.N/A
Submitted PR #7837 to address this issue.
Had some issues with my author info. Will have to close and open a new PR. Sorry about this.
Closing issue as fix merged to master. Thanks!
I'm still seeing this issue in master. Did the referenced PR actually fix this for the generated client code or just for this library's code?
Most helpful comment
I'm still seeing this issue in master. Did the referenced PR actually fix this for the generated client code or just for this library's code?