From 5a466dcc858145210b3d1c0d234741c0fc9a79a8 Mon Sep 17 00:00:00 2001 From: Sebastian Noack Date: Sat, 6 Jan 2024 16:10:22 -0500 Subject: [PATCH] Make the type of the parameters a generic --- index.d.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/index.d.ts b/index.d.ts index 5c1f9a3..7c95874 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,15 +1,15 @@ -export default class Hubkit { +export default class Hubkit { static defaults: Options & {stats: Stats}; static Stats: StatsClass; static readonly RETRY: unique symbol; static readonly DONT_RETRY: unique symbol; - constructor(options?: Options); - defaultOptions: Options; - request(path: string, options?: Options): Promise; + constructor(options?: Options & TParams); + defaultOptions: Options & TParams; + request(path: string, options?: Options & Parameters): Promise; graph(query: string, options?: Options & {variables?: Record}): Promise; - interpolate(string: string, options?: Record); - scope(options: Options); + interpolate(string: string, options?: Parameters); + scope(options: Options & Tsource): Hubkit; } interface Options { @@ -42,8 +42,6 @@ interface Options { clientId?: string; clientSecret?: string; - [key: string]: any; - onSend?(cause: 'initial' | 'retry' | 'page'): number; // returns timeout onError?(error: Error & { status?: number, @@ -60,6 +58,10 @@ interface Options { undefined | typeof Hubkit.RETRY | typeof Hubkit.DONT_RETRY | any; } +interface Parameters { + [key: string]: any; +} + interface StatsClass { new(): Stats; }