SolidJSS
SolidJSโ€ข3y agoโ€ข
2 replies
aryzing

Type of setStore args?

When trying to listen for any and all changes to a store value, seems the only way of being able to do so is to wrap the store's setter like so,

const [store, _setStore] = createStore({});
function setStore(...args) {
  _setStore(...args);
  doStuff(store);
}


What is the correct type for ...args? When typed as below, the type of the args is never, which throws errors in the existing setters,

  function setStore(...args: Parameters<typeof setState>) {
    _setStore(...args);
    doStuff(store);
  }
Was this page helpful?