Skip to content

Commit

Permalink
fixup! refactor: use @ts-expect-error to keep error suppression up …
Browse files Browse the repository at this point in the history
…to date
  • Loading branch information
mikavilpas committed Sep 5, 2024
1 parent be1b875 commit 241145a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ export const createClient = (config: Config): Client => {
instance.defaults = {
...instance.defaults,
..._config,
// @ts-ignore
// @ts-expect-error
headers: mergeHeaders(instance.defaults.headers, _config.headers),
};
return getConfig();
};

// @ts-ignore
// @ts-expect-error
const request: Client['request'] = async (options) => {
const opts: RequestOptions = {
..._config,
...options,
// @ts-ignore
// @ts-expect-error
headers: mergeHeaders(_config.headers, options.headers),
};
if (opts.body && opts.bodySerializer) {
Expand Down Expand Up @@ -63,7 +63,7 @@ export const createClient = (config: Config): Client => {
if (opts.throwOnError) {
throw e;
}
// @ts-ignore
// @ts-expect-error
e.error = e.response?.data ?? {};
return e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,17 @@ export const mergeHeaders = (

for (const [key, value] of iterator) {
if (value === null) {
// @ts-ignore
// @ts-expect-error
delete mergedHeaders[key];
} else if (Array.isArray(value)) {
for (const v of value) {
// @ts-ignore
// @ts-expect-error
mergedHeaders[key] = [...(mergedHeaders[key] ?? []), v as string];
}
} else if (value !== undefined) {
// assume object headers are meant to be JSON stringified, i.e. their
// content value in OpenAPI specification is 'application/json'
// @ts-ignore
// @ts-expect-error
mergedHeaders[key] =
typeof value === 'object' ? JSON.stringify(value) : (value as string);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ export const createClient = (config: Config): Client => {
instance.defaults = {
...instance.defaults,
..._config,
// @ts-ignore
// @ts-expect-error
headers: mergeHeaders(instance.defaults.headers, _config.headers),
};
return getConfig();
};

// @ts-ignore
// @ts-expect-error
const request: Client['request'] = async (options) => {
const opts: RequestOptions = {
..._config,
...options,
// @ts-ignore
// @ts-expect-error
headers: mergeHeaders(_config.headers, options.headers),
};
if (opts.body && opts.bodySerializer) {
Expand Down Expand Up @@ -63,7 +63,7 @@ export const createClient = (config: Config): Client => {
if (opts.throwOnError) {
throw e;
}
// @ts-ignore
// @ts-expect-error
e.error = e.response?.data ?? {};
return e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,17 @@ export const mergeHeaders = (

for (const [key, value] of iterator) {
if (value === null) {
// @ts-ignore
// @ts-expect-error
delete mergedHeaders[key];
} else if (Array.isArray(value)) {
for (const v of value) {
// @ts-ignore
// @ts-expect-error
mergedHeaders[key] = [...(mergedHeaders[key] ?? []), v as string];
}
} else if (value !== undefined) {
// assume object headers are meant to be JSON stringified, i.e. their
// content value in OpenAPI specification is 'application/json'
// @ts-ignore
// @ts-expect-error
mergedHeaders[key] =
typeof value === 'object' ? JSON.stringify(value) : (value as string);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export const createClient = (config: Config = {}): Client => {

const interceptors = createInterceptors<Request, Response, RequestOptions>();

// @ts-ignore
// @ts-expect-error
const request: Client['request'] = async (options) => {
// @ts-ignore
// @ts-expect-error
const opts: RequestOptions = {
..._config,
...options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export const createClient = (config: Config = {}): Client => {

const interceptors = createInterceptors<Request, Response, RequestOptions>();

// @ts-ignore
// @ts-expect-error
const request: Client['request'] = async (options) => {
// @ts-ignore
// @ts-expect-error
const opts: RequestOptions = {
..._config,
...options,
Expand Down

0 comments on commit 241145a

Please sign in to comment.