From 1a2ff8d6d9c380213b48e9256a920b446febd032 Mon Sep 17 00:00:00 2001 From: enzoaicardi Date: Tue, 23 Jul 2024 11:04:39 +0200 Subject: [PATCH] [ts] add back generics --- dist/index.d.ts | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index e81f8ac..2b4e1dc 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -40,19 +40,29 @@ declare module "vifjs" { * @see {@link https://github.com/vifjs/vif/tree/main/wiki/methods/define.md} */ type VifArguments = { - props?: Object; + props?: VifArgumentsProps; html?: (string: TemplateStringsArray) => string; css?: (string: TemplateStringsArray) => string; }; - interface VifSignal { - (updatedValue?: any): [updatedValue: any]; - value: [updatedValue: any]; + interface VifArgumentsProps { + [key: string]: any; + } + + interface VifSignal { + (updatedValue?: Type): [updatedValue: Type]; + value: [updatedValue: Type]; } type VifReactive = Function; - interface VifTranslations extends VifSignal { + type VifTranslationsObject = { + [country: string]: { + [province: string]: () => Promise; + }; + }; + + interface VifTranslations extends VifSignal { /** * Execute a callback after translations have been loaded * @param {Function} callback Function called after translations have been loaded @@ -78,7 +88,7 @@ declare module "vifjs" { * @returns {VifSignal} A signal that can be used to trigger reactives functions * @see {@link https://github.com/vifjs/vif/tree/main/wiki/methods/signal.md} */ - function useSignal(initialValue: any): VifSignal; + function useSignal(initialValue: Type): VifSignal; /** * Function used to create a reactive function played every time the value of a signal inside changes @@ -110,9 +120,5 @@ declare module "vifjs" { * @returns {VifTranslations} Signal containing all the translations for the current locale * @see {@link https://github.com/vifjs/vif/tree/main/wiki/methods/i18n.md} */ - function useI18n(locales: { - [country: string]: { - [province: string]: () => Promise; - }; - }): VifTranslations; + function useI18n(locales: VifTranslationsObject): VifTranslations; }