swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[Angular2][Typescript] Get rid of typings?

Open BastiOfBerlin opened this issue 9 years ago • 1 comments

Description

I ran into several issues with the generated client API concerning typings:

1st of all, when the resulting npm project is built, it gives the following deprecation warning: typings WARN deprecated 2016-9-14: "registry:dt/core-js#0.0.0+20160725163759" is deprecated (updated, replaced or removed)

And the second point, which is quite more important to me: typings cannot properly be used in an offline environment with only a Nexus as proxy. The reason: I figured out how to proxy the typings registry itself, but not the succeeding call to raw.githubusercontent.com

So I asked myself, is it really necessary to have a dependency to typings, since the generated Typescript interfaces should be sufficient for the transpiler and IDE to determine both API methods and models?

Swagger-codegen version

2.2.2-SNAPSHOT

BastiOfBerlin avatar Feb 09 '17 15:02 BastiOfBerlin

What I did to remove the typings dependency in the generated code:

In package.json added "@types/core-js": "^0.9.35" and changed "typescript": "~2.1.5"

By using Typescript 2, I can use the ts compiler option "typeRoots": ["./node_modules/@types"] in tsconfig.json and everything builds fine.

What do think of that change?

And when modifying the template for package.json, would it make sense to update several of those (peer-) dependencies as well, i.e. angular or rxjs?

BastiOfBerlin avatar Feb 09 '17 17:02 BastiOfBerlin