这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/weak-wombats-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/openapi-ts": patch
---

fix various warnings in generated client code
2 changes: 1 addition & 1 deletion src/templates/core/angular/getHeaders.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const getHeaders = (config: OpenAPIConfig, options: ApiRequestOptions): O
...additionalHeaders,
...options.headers,
})
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.reduce((headers, [key, value]) => ({
...headers,
[key]: String(value),
Expand Down
2 changes: 1 addition & 1 deletion src/templates/core/axios/getHeaders.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptio
...options.headers,
...formHeaders,
})
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.reduce((headers, [key, value]) => ({
...headers,
[key]: String(value),
Expand Down
2 changes: 1 addition & 1 deletion src/templates/core/fetch/getHeaders.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptio
...additionalHeaders,
...options.headers,
})
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.reduce((headers, [key, value]) => ({
...headers,
[key]: String(value),
Expand Down
4 changes: 2 additions & 2 deletions src/templates/core/functions/getFormData.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
if (options.formData) {
const formData = new FormData();

const process = (key: string, value: any) => {
const process = (key: string, value: unknown) => {
if (isString(value) || isBlob(value)) {
formData.append(key, value);
} else {
Expand All @@ -11,7 +11,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
};

Object.entries(options.formData)
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach(v => process(key, v));
Expand Down
1 change: 0 additions & 1 deletion src/templates/core/functions/isBlob.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const isBlob = (value: any): value is Blob => {
typeof value.constructor === 'function' &&
typeof value.constructor.name === 'string' &&
/^(Blob|File)$/.test(value.constructor.name) &&
// @ts-ignore
/^(Blob|File)$/.test(value[Symbol.toStringTag])
);
};
2 changes: 1 addition & 1 deletion src/templates/core/node/getHeaders.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptio
...additionalHeaders,
...options.headers,
})
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.reduce((headers, [key, value]) => ({
...headers,
[key]: String(value),
Expand Down
2 changes: 1 addition & 1 deletion src/templates/core/xhr/getHeaders.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptio
...additionalHeaders,
...options.headers,
})
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.reduce((headers, [key, value]) => ({
...headers,
[key]: String(value),
Expand Down
7 changes: 3 additions & 4 deletions test/__snapshots__/v2/test/generated/v2/core/request.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const isBlob = (value: any): value is Blob => {
typeof value.constructor === 'function' &&
typeof value.constructor.name === 'string' &&
/^(Blob|File)$/.test(value.constructor.name) &&
// @ts-ignore
/^(Blob|File)$/.test(value[Symbol.toStringTag])
);
};
Expand Down Expand Up @@ -87,7 +86,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
if (options.formData) {
const formData = new FormData();

const process = (key: string, value: any) => {
const process = (key: string, value: unknown) => {
if (isString(value) || isBlob(value)) {
formData.append(key, value);
} else {
Expand All @@ -96,7 +95,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
};

Object.entries(options.formData)
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach(v => process(key, v));
Expand Down Expand Up @@ -132,7 +131,7 @@ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptio
...additionalHeaders,
...options.headers,
})
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.reduce(
(headers, [key, value]) => ({
...headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const isBlob = (value: any): value is Blob => {
typeof value.constructor === 'function' &&
typeof value.constructor.name === 'string' &&
/^(Blob|File)$/.test(value.constructor.name) &&
// @ts-ignore
/^(Blob|File)$/.test(value[Symbol.toStringTag])
);
};
Expand Down Expand Up @@ -87,7 +86,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
if (options.formData) {
const formData = new FormData();

const process = (key: string, value: any) => {
const process = (key: string, value: unknown) => {
if (isString(value) || isBlob(value)) {
formData.append(key, value);
} else {
Expand All @@ -96,7 +95,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
};

Object.entries(options.formData)
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach(v => process(key, v));
Expand Down Expand Up @@ -132,7 +131,7 @@ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptio
...additionalHeaders,
...options.headers,
})
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.reduce(
(headers, [key, value]) => ({
...headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const isBlob = (value: any): value is Blob => {
typeof value.constructor === 'function' &&
typeof value.constructor.name === 'string' &&
/^(Blob|File)$/.test(value.constructor.name) &&
// @ts-ignore
/^(Blob|File)$/.test(value[Symbol.toStringTag])
);
};
Expand Down Expand Up @@ -87,7 +86,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
if (options.formData) {
const formData = new FormData();

const process = (key: string, value: any) => {
const process = (key: string, value: unknown) => {
if (isString(value) || isBlob(value)) {
formData.append(key, value);
} else {
Expand All @@ -96,7 +95,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
};

Object.entries(options.formData)
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach(v => process(key, v));
Expand Down Expand Up @@ -132,7 +131,7 @@ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptio
...additionalHeaders,
...options.headers,
})
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.reduce(
(headers, [key, value]) => ({
...headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const isBlob = (value: any): value is Blob => {
typeof value.constructor === 'function' &&
typeof value.constructor.name === 'string' &&
/^(Blob|File)$/.test(value.constructor.name) &&
// @ts-ignore
/^(Blob|File)$/.test(value[Symbol.toStringTag])
);
};
Expand Down Expand Up @@ -87,7 +86,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
if (options.formData) {
const formData = new FormData();

const process = (key: string, value: any) => {
const process = (key: string, value: unknown) => {
if (isString(value) || isBlob(value)) {
formData.append(key, value);
} else {
Expand All @@ -96,7 +95,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
};

Object.entries(options.formData)
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach(v => process(key, v));
Expand Down Expand Up @@ -132,7 +131,7 @@ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptio
...additionalHeaders,
...options.headers,
})
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.reduce(
(headers, [key, value]) => ({
...headers,
Expand Down
7 changes: 3 additions & 4 deletions test/__snapshots__/v3/test/generated/v3/core/request.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const isBlob = (value: any): value is Blob => {
typeof value.constructor === 'function' &&
typeof value.constructor.name === 'string' &&
/^(Blob|File)$/.test(value.constructor.name) &&
// @ts-ignore
/^(Blob|File)$/.test(value[Symbol.toStringTag])
);
};
Expand Down Expand Up @@ -87,7 +86,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
if (options.formData) {
const formData = new FormData();

const process = (key: string, value: any) => {
const process = (key: string, value: unknown) => {
if (isString(value) || isBlob(value)) {
formData.append(key, value);
} else {
Expand All @@ -96,7 +95,7 @@ export const getFormData = (options: ApiRequestOptions): FormData | undefined =>
};

Object.entries(options.formData)
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach(v => process(key, v));
Expand Down Expand Up @@ -132,7 +131,7 @@ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptio
...additionalHeaders,
...options.headers,
})
.filter(([_, value]) => value !== undefined && value !== null)
.filter(([, value]) => value !== undefined && value !== null)
.reduce(
(headers, [key, value]) => ({
...headers,
Expand Down