-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP Proposal: adding [Symbol.dispose] to check unhandled Result #552
Conversation
Maybe this can also be helpful for issues like #525 |
I think having improvements to signal that you have unhandled / swalled errors in your stack would be awesome. Are you able to provide examples of how this API would address this problem? |
|
bump typescript and jest dependencies
@supermacro Sorry, rebased this branch with upstream commits and GitHub closed it automatically. This idea behind this is to leverage the Symbol.dispose new functionality. const someFunc = () => {
using anExampleResult = aFunctionReturningAResult();
} for example this would throw an |
tbh this was more a wild idea that a real proposal bc I see several issues (people forgetting the I'd be happy to improve this or keep working on it if you or others think it would be a great addition tho! |
Also curious to know @mattpocock if you have thoughts on how to improve this or examples of more complex Symbol.dispose use cases |
Don't see how |
@pnodet Gotcha, that makes sense. Feels possible, but I'm not sure how intuitive the API will feel to most users. |
I don't know if it's a use case of
https://github.com/tc39/proposal-explicit-resource-management |
Yeah, this feels like |
Identifying if a result is used or not should be done statically (prob through a linter) rather than at runtime, no? Closing for now |
Typescript 5.2 introduced the
using
keyword.One thing that I find hard with neverthrow is checking for unhandled result.
The eslint plugin brings helpful linter errors but I wanted to try implementing [Symbol.dispose] and see if it can help the DX.