I have a SolidJS store defined:
const [store, setStore] = createStore<SomeComplexType>();
I need to run some code before every execution of setStore, so I would like to wrap it with my own function. Is there a way to do that that preserves all types and all overloads?
I've tried:
const setStore: SetStoreFunction<SomeComplexType> = (...args: Parameters<SetStoreFunction<SomeComplexType>>) => {
setStore_(...args);
};
But I get an error:
A spread argument must either have a tuple type or be passed to a rest parameter.

The best solution I heard is using
any[]for the parameter type and castingsetStoretoany. It preserves types and doesn't require suppression via annotations.TS Playground
Credits to Maciek50322.