You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No real opinion on the naming, just not sure what else to call it.
When authoring a custom plugin for various build tools (ex. vite), the plugin lifecycle callback functions are typically allowed to be sync or async. If a plugin author wanted to extend that to the plugin consumers via the plugin's input options, that would allow the plugin consumer to delay certain operations until the plugin actually needs it.
Ex. If there's an input that would require the caller to import from another module, and using ESM they could prefer a dynamic import which would only be executed when the plugin calls the thunk. otoh, a different consumer might want to pass a static value.
Type source
/** * A value or a function that returns the value */exporttypeThunkable<T>=T|(()=>T);
Search existing types and issues first
I tried my best to look for it
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
The funding will be given to active contributors.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered:
Type description + examples
Super simple type, it takes one generic and returns a union of it or a function that returns it.
No real opinion on the naming, just not sure what else to call it.
When authoring a custom plugin for various build tools (ex. vite), the plugin lifecycle callback functions are typically allowed to be sync or async. If a plugin author wanted to extend that to the plugin consumers via the plugin's input options, that would allow the plugin consumer to delay certain operations until the plugin actually needs it.
Ex. If there's an input that would require the caller to import from another module, and using ESM they could prefer a dynamic import which would only be executed when the plugin calls the thunk. otoh, a different consumer might want to pass a static value.
Type source
Search existing types and issues first
Upvote & Fund
The text was updated successfully, but these errors were encountered: