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

Update to TypeScript 3.8 #4100

Merged
merged 14 commits into from
Feb 25, 2020
Merged

Update to TypeScript 3.8 #4100

merged 14 commits into from
Feb 25, 2020

Conversation

kitsonk
Copy link
Contributor

@kitsonk kitsonk commented Feb 24, 2020

This PR updates Deno to TypeScript 3.8.

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). The TypeScript error recommends adding export {}; to the file, which is the current idiomatic way of identifying a module as a module that otherwise has no imports or exports.

Resolves #3937
Resolves #3301
Resolves #3391

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
There was a change/regression with eslint where it requires a symbolic
link now to node_modules in order to resolve all the plugins.
@kitsonk
Copy link
Contributor Author

kitsonk commented Feb 24, 2020

Note on adding (back) a symbolic link for node_modules... it seems recent versions of eslint throw if this isn't present, stating the plugins referenced in the config are invalid. I haven't chased down what or how this was introduced, or if there is a better workaround.

The error is like this:

Oops! Something went wrong! :(

ESLint: 6.8.0.

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "/home/runner/work/deno/deno".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

eslint

We need to have more current version of eslint and associated plugins to make sure we are supporting things like TLA and private fields that were recently introduced to ECMAScript and supported in TypeScript.

@bartlomieju bartlomieju requested a review from ry February 24, 2020 04:10
node_modules Outdated
@@ -0,0 +1 @@
third_party/node_modules
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:<

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned above #4100 (comment)

@@ -5,3 +5,4 @@ for (const filename of filenames) {
await Deno.copy(Deno.stdout, file);
file.close();
}
export {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems very odd for the cat example. Why are these getting added everywhere?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't see your comment above.

The TypeScript error recommends adding export {}; to the file, which is the current idiomatic way of identifying a module as a module that otherwise has no imports or exports.

I want to find a way to work around this. export {} doesn't make sense in these examples. I will look into it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't think you can unless you really do something ugly behind the scenes. See: microsoft/TypeScript#18232. There is a Stage 1 proposal to try to fix it: https://github.com/tc39/proposal-modules-pragma.

Maybe we should just ignore the error again, because we never have non-modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we ignore it, we need to check the emit on bundles... as TypeScript might not emit an async function for the module, which it didn't do in TS 3.7.

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks @kitsonk ~

@ry ry merged commit be787d0 into denoland:master Feb 25, 2020
dubiousjim added a commit to dubiousjim/deno that referenced this pull request Feb 26, 2020
* tag 'dm': (58 commits)
  Port permission_prompt_tests to Rust (denoland#4129)
  upgrade: TypeScript 3.8 (denoland#4100)
  Remove _async from method names since _sync are gone (denoland#4128)
  ci: Use fetch-depth: 5 (denoland#4127)
  fix: Resolve makeTemp* paths from CWD (denoland#4104)
  Clean up how we use opIds (denoland#4118)
  Fix issues with JavaScript importing JavaScript. (denoland#4120)
  fix: [http] Consume unread body and trailers before reading next request (denoland#3990)
  Remove ansi_term dependency (denoland#4116)
  port tools/repl_test.py to Rust (denoland#4096)
  Revert "Remove ansi_term dependency"
  fix: createSecKey logic (denoland#4063)
  Add Deno.Err change missing from previous commit (denoland#4113)
  rename Deno.Err -> Deno.errors (denoland#4093)
  doc: Remove old link to deno types output (denoland#4111)
  feat: Add Deno.formatDiagnostics (denoland#4032)
  disable std/examples/chat tests for windows (denoland#4109)
  update build instructions for windows (denoland#4027)
  Remove ansi_term dependency (denoland#4106)
  fix: add mutex guard for permission_prompt tests (denoland#4105)
  ...
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 21, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Feb 1, 2021
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 this pull request may close these issues.

Support TypeScript 3.8 Top level await breaks on parentheses TLA not supported in bundles
2 participants