johnlindquist / kit

Script Kit. Automate Anything.
https://scriptkit.com
MIT License
3.91k stars 138 forks source link

Loosen the typings of `Shortcut["onPress"]` to allow an arbitrary return value #1465

Closed JosXa closed 5 months ago

JosXa commented 6 months ago

I don't anticipate the return value to be checked at any point in the future, thus allowing users to return whatever they want from the promise should be fine.

See this error for motivation: image

I'd argue it's generally good practice to allow user-defined callbacks to return anything, which is commonly done by annotating the return type as unknown. This holds as long as no shenanigans like (...) => typeof preventSubmit are planned.