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

@@ -7,19 +7,18 @@ import type {
ILoadOptionsFunctions,
} from 'n8n-core';
import type { IBinaryKeyData, IDataObject, INodeExecutionData } from 'n8n-workflow';
import type { IBinaryKeyData, IDataObject, INodeExecutionData, JsonObject } from 'n8n-workflow';
import { NodeApiError, NodeOperationError, sleep } from 'n8n-workflow';
export async function twitterApiRequest(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IHookFunctions,
method: string,
resource: string,
body: any = {},
body: IDataObject = {},
qs: IDataObject = {},
uri?: string,
option: IDataObject = {},
): Promise<any> {
) {
let options: OptionsWithUrl = {
method,
body,
@@ -37,10 +36,9 @@ export async function twitterApiRequest(
if (Object.keys(qs).length === 0) {
delete options.qs;
}
//@ts-ignore
return await this.helpers.requestOAuth1.call(this, 'twitterOAuth1Api', options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -49,10 +47,9 @@ export async function twitterApiRequestAllItems(
propertyName: string,
method: string,
endpoint: string,
body: any = {},
body: IDataObject = {},
query: IDataObject = {},
): Promise<any> {
) {
const returnData: IDataObject[] = [];
let responseData;
@@ -62,7 +59,7 @@ export async function twitterApiRequestAllItems(
do {
responseData = await twitterApiRequest.call(this, method, endpoint, body, query);
query.since_id = responseData.search_metadata.max_id;
returnData.push.apply(returnData, responseData[propertyName]);
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
} while (responseData.search_metadata?.next_results);
return returnData;