fix(core): Remove linting exceptions in nodes-base, @typescript-eslint/no-unsafe-argument (no-changelog)

This commit is contained in:
Michael Kret
2023-02-28 05:39:43 +02:00
committed by GitHub
parent 3172ea376e
commit bb4db58819
560 changed files with 2227 additions and 1919 deletions

View File

@@ -5,6 +5,7 @@ import type {
INodeType,
INodeTypeBaseDescription,
INodeTypeDescription,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError, NodeOperationError, sleep } from 'n8n-workflow';
@@ -25,6 +26,7 @@ interface OptionDataParamters {
[key: string]: OptionData;
}
type OptionsWithUriKeys = keyof OptionsWithUri;
export class HttpRequestV2 implements INodeType {
description: INodeTypeDescription;
@@ -864,7 +866,9 @@ export class HttpRequestV2 implements INodeType {
// If it is not an object && bodyContentType is not 'raw' it must be JSON so parse it
try {
// @ts-ignore
requestOptions[optionData.name] = JSON.parse(requestOptions[optionData.name]);
requestOptions[optionData.name] = JSON.parse(
requestOptions[optionData.name as OptionsWithUriKeys] as string,
);
} catch (error) {
throw new NodeOperationError(
this.getNode(),
@@ -1037,7 +1041,7 @@ export class HttpRequestV2 implements INodeType {
if (response!.status !== 'fulfilled') {
if (!this.continueOnFail()) {
// throw error;
throw new NodeApiError(this.getNode(), response);
throw new NodeApiError(this.getNode(), response as JsonObject);
} else {
// Return the actual reason as error
returnItems.push({
@@ -1092,14 +1096,14 @@ export class HttpRequestV2 implements INodeType {
newItem.json = returnItem;
newItem.binary![dataPropertyName] = await this.helpers.prepareBinaryData(
response!.body,
response!.body as Buffer,
fileName,
);
} else {
newItem.json = items[itemIndex].json;
newItem.binary![dataPropertyName] = await this.helpers.prepareBinaryData(
response!,
response! as Buffer,
fileName,
);
}