diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache index 233ead8bee4..9681634a765 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache @@ -3,7 +3,7 @@ /* tslint:disable:no-unused-variable member-ordering */ {{#operations}} -module {{package}} { +namespace {{package}} { 'use strict'; {{#description}} @@ -16,7 +16,7 @@ module {{package}} { static $inject: string[] = ['$http', '$httpParamSerializer']; - constructor(private $http: ng.IHttpService, basePath?: string, private $httpParamSerializer?: (any) => any) { + constructor(private $http: ng.IHttpService, basePath?: string, private $httpParamSerializer?: (d: any) => any) { if (basePath) { this.basePath = basePath; } @@ -24,16 +24,16 @@ module {{package}} { {{#operation}} public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> { - var path = this.basePath + '{{path}}'; + let path = this.basePath + '{{path}}'; {{#pathParams}} path = path.replace('{' + '{{baseName}}' + '}', String({{paramName}})); {{/pathParams}} - var queryParameters: any = {}; - var headerParams: any = {}; + let queryParameters: any = {}; + let headerParams: any = {}; {{#hasFormParams}} - var formParams: any = {}; + let formParams: any = {}; {{/hasFormParams}} {{#allParams}} @@ -63,7 +63,7 @@ module {{package}} { formParams['{{baseName}}'] = {{paramName}}; {{/formParams}} - var httpRequestParams: any = { + let httpRequestParams: any = { method: '{{httpMethod}}', url: path, json: {{#hasFormParams}}false{{/hasFormParams}}{{^hasFormParams}}true{{/hasFormParams}}, @@ -76,7 +76,7 @@ module {{package}} { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { + for (let k in extraHttpRequestParams) { if (extraHttpRequestParams.hasOwnProperty(k)) { httpRequestParams[k] = extraHttpRequestParams[k]; } diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/model.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Angular/model.mustache index b425d14d5e4..5b57ed4dc94 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/model.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Angular/model.mustache @@ -1,6 +1,6 @@ /// -module {{package}} { +namespace {{package}} { 'use strict'; {{#models}} @@ -10,7 +10,7 @@ module {{package}} { * {{{description}}} */ {{/description}} - export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ + export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ {{#vars}} {{#description}} @@ -23,7 +23,7 @@ module {{package}} { } {{#hasEnums}} - export module {{classname}} { + export namespace {{classname}} { {{#vars}} {{#isEnum}} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache index 6528a5d3a22..4d03ae0f424 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache @@ -27,7 +27,7 @@ export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ } {{#hasEnums}} -export module {{classname}} { +export namespace {{classname}} { {{#vars}} {{#isEnum}} export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} @@ -157,15 +157,15 @@ export class {{classname}} { {{#operation}} public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}} }> { - var path = this.url + this.basePath + '{{path}}'; + let path = this.url + this.basePath + '{{path}}'; {{#pathParams}} path = path.replace('{' + '{{baseName}}' + '}', String({{paramName}})); {{/pathParams}} - var queryParameters: any = {}; - var headerParams: any = {}; - var formParams: any = {}; + let queryParameters: any = {}; + let headerParams: any = {}; + let formParams: any = {}; {{#allParams}}{{#required}} // verify required parameter '{{paramName}}' is set @@ -183,7 +183,7 @@ export class {{classname}} { headerParams['{{baseName}}'] = {{paramName}}; {{/headerParams}} - var useFormData = false; + let useFormData = false; {{#formParams}} if ({{paramName}} !== undefined) { @@ -194,9 +194,9 @@ export class {{classname}} { {{/isFile}} {{/formParams}} - var deferred = promise.defer<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}} }>(); + let deferred = promise.defer<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}} }>(); - var requestOptions: request.Options = { + let requestOptions: request.Options = { method: '{{httpMethod}}', qs: queryParameters, headers: headerParams,