Suppress eslint explicit any warnings required for the advanced type trickery to work.

At the call site the types are correct, it is just the type signatures that require any.
This commit is contained in:
Andreas Svanberg 2025-04-11 00:53:38 +02:00
parent c1647ab498
commit ad515c5be9
Signed by: ansv7779
GPG Key ID: 729B051CFFD42F92
2 changed files with 4 additions and 4 deletions
frontend/src

@ -6,8 +6,8 @@ type MessageType = typeof messages;
type MessageKeys = keyof MessageType;
type MessageParams<T extends MessageKeys> = MessageType[T]["en"] extends (
...args: any
) => any
...args: any // eslint-disable-line @typescript-eslint/no-explicit-any
) => any // eslint-disable-line @typescript-eslint/no-explicit-any
? Parameters<MessageType[T]["en"]>
: [];
@ -19,7 +19,7 @@ export function useI18n() {
...args: MessageParams<T>
): string {
const message = messages[key][lang] ?? messages[key]["en"];
// @ts-ignore
// @ts-expect-error see https://stackoverflow.com/a/75086839
return typeof message === "function" ? message(...args) : message;
};
}

@ -19,5 +19,5 @@ export const messages = {
},
} as const satisfies Record<
string,
AllLanguages<string | ((...args: any) => string)>
AllLanguages<string> | AllLanguages<(...args: any) => string> // eslint-disable-line @typescript-eslint/no-explicit-any
>;