Omnistac / zedux

:zap: A Molecular State Engine for React
https://Omnistac.github.io/zedux/
MIT License
344 stars 7 forks source link

fix(atoms): make it easier for TS to infer AtomApi types from chained methods #49

Closed bowheart closed 1 year ago

bowheart commented 1 year ago

Description

TS struggles breaking down an AtomApi's type when chained methods (e.g. .setPromise(), .setExports(), etc) are called and extra layers are added (e.g. put the whole thing in a function called in a component and pass more inferred types - at least that's the general idea).

The Prettify helper doesn't need to wrap the whole class. Make it only wrap the Omit. This apparently drastically reduces the work TS has to do.