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

TLA not supported in bundles #3301

Closed
kitsonk opened this issue Nov 9, 2019 · 4 comments · Fixed by #4100
Closed

TLA not supported in bundles #3301

kitsonk opened this issue Nov 9, 2019 · 4 comments · Fixed by #4100

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Nov 9, 2019

Currently, TypeScript does not support TLA (including 3.7). This means when we emit a bundle, we depend on the TypeScript compiler to generate the modules as AMD modules, and it does not realise that it needs to turn the define callback into an async function, meaning the await that was previously top level now is in a function that isn't async, throwing a syntax error at runtime.

We will need TLA formally supported in TypeScript, instead of just ignoring the error to resolve this.

@kitsonk
Copy link
Contributor Author

kitsonk commented Dec 22, 2019

TLA has landed in TS 3.8. So when that gets released (early Feb 2020) we will be able to resolve this.

@ry
Copy link
Member

ry commented Dec 23, 2019

Since we use TS as a git submodule we could actually upgrade already... but maybe it’s better to wait for release.

@kitsonk
Copy link
Contributor Author

kitsonk commented Dec 27, 2019

I would say we would want to at least wait for the RC. Master can be a bit of a wild ride.

kitsonk added a commit to kitsonk/deno that referenced this issue Feb 11, 2020
Moves to using a minimal System loader for bundles generated by Deno.
TypeScript in 3.8 will be able to output TLA for modules, and the loader
is written to take advantage of that as soon as we update Deno to TS
3.8.

System also allows us to support `import.meta` and provide more ESM
aligned assignment of exports, as well as there is better handling of
circular imports.

The loader is also very terse versus to try to save overhead.

Also, fixed an issue where abstract classes were not being rexported.

Fixes denoland#2553
Fixes denoland#3559
Fixes denoland#3751
Fixes denoland#3825
Refs denoland#3301
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 11, 2020
Moves to using a minimal System loader for bundles generated by Deno.
TypeScript in 3.8 will be able to output TLA for modules, and the loader
is written to take advantage of that as soon as we update Deno to TS
3.8.

System also allows us to support `import.meta` and provide more ESM
aligned assignment of exports, as well as there is better handling of
circular imports.

The loader is also very terse versus to try to save overhead.

Also, fixed an issue where abstract classes were not being rexported.

Fixes denoland#2553
Fixes denoland#3559
Fixes denoland#3751
Fixes denoland#3825
Refs denoland#3301
ry pushed a commit that referenced this issue Feb 12, 2020
Moves to using a minimal System loader for bundles generated by Deno.
TypeScript in 3.8 will be able to output TLA for modules, and the loader
is written to take advantage of that as soon as we update Deno to TS
3.8.

System also allows us to support `import.meta` and provide more ESM
aligned assignment of exports, as well as there is better handling of
circular imports.

The loader is also very terse versus to try to save overhead.

Also, fixed an issue where abstract classes were not being re-exported.

Fixes #2553
Fixes #3559
Fixes #3751
Fixes #3825
Refs #3301
@kitsonk
Copy link
Contributor Author

kitsonk commented Feb 12, 2020

The improvements to bundling is part of the solution for top level await. And #3937 will automatically close this without further work.

kitsonk added a commit to kitsonk/deno that referenced this issue Feb 24, 2020
In regards to top-level-await, TypeScript will throw if the input does
not look like a module (as top-level-await is not supported in scripts).
TypeScript recommends adding `export {};` to the file, which is the
current idomatic way of identifying a module as a module that otherwise
has no imports or exports.

Resolves denoland#3937
Resolves denoland#3301
Resolves denoland#3391
@ry ry closed this as completed in #4100 Feb 25, 2020
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

Successfully merging a pull request may close this issue.

2 participants