I’m sure this is easy, but I don’t seem to be able to find an answer (or maybe ask the right question!)
I have a library function (specifically, an i18n.translator
from here: https://primitives.solidjs.community/package/i18n#static-dictionaries), which I want to wrap with another function to provide some fallback value based on other logic.
const translator = i18n.translator(dict);
const custom_translator = (path, args?): string => {
const translation = translator(path, args);
if (translation) { return translation };
return "Some fallback";
}
How do I make the custom_translator
parameters the same types as translator
? (the i18n.translator
does some complex type inference on the dict
object, so path
is not just a string!)