diff --git a/samples/client/others/typescript/builds/null-types-simple/.gitattributes b/samples/client/others/typescript/builds/null-types-simple/.gitattributes new file mode 100644 index 000000000000..7bf5a17b22f1 --- /dev/null +++ b/samples/client/others/typescript/builds/null-types-simple/.gitattributes @@ -0,0 +1,8 @@ +**/* linguist-generated +*.md linguist-documentation + +.gitattributes text +.gitattributes export-ignore + +.gitignore text +.gitignore export-ignore diff --git a/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES b/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES index aaf21969459a..f586694f5f67 100644 --- a/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES +++ b/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES @@ -1,3 +1,4 @@ +.gitattributes .gitignore README.md apis/baseapi.ts diff --git a/samples/client/others/typescript/builds/null-types-simple/http/http.ts b/samples/client/others/typescript/builds/null-types-simple/http/http.ts index f38a52ec1300..b0d0d479e219 100644 --- a/samples/client/others/typescript/builds/null-types-simple/http/http.ts +++ b/samples/client/others/typescript/builds/null-types-simple/http/http.ts @@ -33,6 +33,8 @@ export class HttpException extends Error { */ export type RequestBody = undefined | string | FormData | URLSearchParams; +type Headers = Record; + function ensureAbsoluteUrl(url: string) { if (url.startsWith("http://") || url.startsWith("https://")) { return url; @@ -44,7 +46,7 @@ function ensureAbsoluteUrl(url: string) { * Represents an HTTP request context */ export class RequestContext { - private headers: { [key: string]: string } = {}; + private headers: Headers = {}; private body: RequestBody = undefined; private url: URL; @@ -93,7 +95,7 @@ export class RequestContext { return this.httpMethod; } - public getHeaders(): { [key: string]: string } { + public getHeaders(): Headers { return this.headers; } @@ -160,7 +162,7 @@ export class SelfDecodingBody implements ResponseBody { export class ResponseContext { public constructor( public httpStatusCode: number, - public headers: { [key: string]: string }, + public headers: Headers, public body: ResponseBody ) {} @@ -171,8 +173,8 @@ export class ResponseContext { * Parameter names are converted to lower case * The first parameter is returned with the key `""` */ - public getParsedHeader(headerName: string): { [parameter: string]: string } { - const result: { [parameter: string]: string } = {}; + public getParsedHeader(headerName: string): Headers { + const result: Headers = {}; if (!this.headers[headerName]) { return result; } @@ -245,7 +247,7 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib export class HttpInfo extends ResponseContext { public constructor( public httpStatusCode: number, - public headers: { [key: string]: string }, + public headers: Headers, public body: ResponseBody, public data: T, ) {