Skip to content
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

[sandbox] Vanilla TypeScript template yields ‘Unexpected keyword or identifier typescript(1434)’ error when using await keyword #8433

Closed
steveluscher opened this issue Apr 26, 2024 · 7 comments

Comments

@steveluscher
Copy link
Contributor

steveluscher commented Apr 26, 2024

Description of the problem

Using the ‘Vanilla TypeScript’ template and authoring a sandbox with the await keyword, I get this TypeScript error:

Unexpected keyword or identifier typescript(1434)

image

How has this issue affected you? What are you trying to accomplish?

I can't create sandboxes that use async/await.

To Reproduce

https://codesandbox.io/p/sandbox/hungry-forest-7djrph

@karl-police
Copy link

This happens on every project

@steveluscher
Copy link
Contributor Author

This happens on every project

I wonder if that's even true. I haven't tested this rigorously, but I seem to remember forking an await-using sandbox like this one, and having it go from not working to… working.

@CompuIves
Copy link
Member

I'm taking a look. It looks like it only affects the TS language server, meaning that the editor is giving an error but the project should work as expected.

@CompuIves
Copy link
Member

This is so interesting! TypeScript just doesn't recognize the await keyword at all, even though it's defined in its parser. I'm getting closer though.

@CompuIves
Copy link
Member

Wooow, I finally found the bug to this. Since TypeScript 5, TypeScript uses a keyword list for await to know if something is a keyword of identifier. Our transpiler in Nodebox mistakingly transpiles the TypeScript source code, though. As a result, you get this:

Nodebox:
Screenshot 2024-04-29 at 14 16 45

Real source code:
Screenshot 2024-04-29 at 14 16 23

await was replaced with yield. For now, I've downgraded TypeScript to fix it, and we're going to build a fix in our transpiler.

@CompuIves
Copy link
Member

Fix should be live now!

@steveluscher
Copy link
Contributor Author

5FDtMRu1

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants