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
I've updated the current Typescript to include this operator as a passthrough (as though it's implemented in Javascript) so we can play around with examples a bit.
The details are basically that when it encounters the try keyword, it first tries to parse it as a statement, then as an expression, unless it's already in an expression context, in which case it parses it as an expression (curly braces become objects).
I'm not sure I like that last part. I think curly braces should be an error unless they are surrounded by parentheses. But this sounds like all the other edge cases we're debating here, and a simple predictable language is better than one with random guarded edges. That's more what linters are for. But it could be a source of unending confusion in this case, so it might be a good idea.
I haven't tested any unusual parts of Javascript yet, like using or for loops.
For actual implementation in TypeScript, I think this should be converted to a self-executing function that returns the appropriate values. It's pretty standard for various syntax types to be converted into helper functions until they are implemented in Javascript.
I've updated the current Typescript to include this operator as a passthrough (as though it's implemented in Javascript) so we can play around with examples a bit.
https://github.com/Arlen22/TypeScript - main branch
I basically just implemented it as an expression operator, based off void and await.
To try it, clone the repo, run the following...
then npm install the output file in an example project. If you're using vscode you can change the tsserver location to get intellisense as well.
The text was updated successfully, but these errors were encountered: