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

Support TypeScript 3.8 #3937

Closed
kitsonk opened this issue Feb 9, 2020 · 5 comments · Fixed by #4100
Closed

Support TypeScript 3.8 #3937

kitsonk opened this issue Feb 9, 2020 · 5 comments · Fixed by #4100

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Feb 9, 2020

The release candidate for TypeScript 3.8 is available. I have a branch updating to TypeScript 3.8. The biggest feature we care about is that private fields and TLA are supported. We were ignoring the TLA errors, and should take advantage of the private fields, as V8 already supports them and they are the best way to ensure private data stays private.

There is one major problem, prettier can't handle private fields at the moment under TypeScript. The tracking issue is prettier/prettier#7263. That means putting private fields in causes prettier to throw when using ./tools/format.py --js. So until prettier updates, it would be hard for us to update.

I also wonder if SWC/dprint handle them as well (cc/ @dsherret) for deno fmt.

@nayeemrmn
Copy link
Collaborator

dprint TypeScript 3.8 Support milestone: https://github.com/dsherret/dprint/milestone/1

@kitsonk
Copy link
Contributor Author

kitsonk commented Feb 12, 2020

I suspect it will take a little while for prettier to support ECMAScript Private Fields in TypeScript, mostly because there are a few upstream dependencies and it isn't just an upgrade for them. That means we might want to land adoption of that later and not concurrently with TS 3.8. The main reason to land TS 3.8 as early as feasible is proper support for TLA, including in bundles.

@dsherret
Copy link
Member

dprint-plugin-typescript 0.6.0 is now released with support for all the new TS 3.8 features... markdown support should come within the next few weeks.

@kitsonk
Copy link
Contributor Author

kitsonk commented Feb 24, 2020

I've got a branch working, but there was a change in behaviour in TypeScript 3.8. Previously, source maps generated by TypeScript utilised the fileName from the SourceFile. Now they appear to use the filename provided by CompilerHost.resolveModules(). The problem was that when we created the source file, when building the internal bundles, we would replace the file:// specifier which specific to the system it was built on with $deno$ so that stack traces would provide an internal identifier when code occurred there.

I am going to have to move the logic we have from CompilerHost.getSourceFile() to CompilerHost.resolveModules(), but that is what is taking a bit longer than a straight forward upgrade.

@ry
Copy link
Member

ry commented Feb 24, 2020

@kitsonk cool - if I can be of any help just point me at a branch.

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.

4 participants