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

Should we compile to ES2018 in Lumino 2? #387

Closed
afshin opened this issue Sep 1, 2022 · 1 comment · Fixed by #388
Closed

Should we compile to ES2018 in Lumino 2? #387

afshin opened this issue Sep 1, 2022 · 1 comment · Fixed by #388
Labels
question Further information is requested
Milestone

Comments

@afshin
Copy link
Member

afshin commented Sep 1, 2022

It seems as though the browsers we support all support ES2018: https://caniuse.com/?search=ES2018

I propose switching to ES2018 as our compilation target:

"target": "ES6",

What do you think?

Pathological case

Out of curiosity, I looked to see how the [Symbol.asyncIterator] function in Poll compiled.

TypeScript source

async *[Symbol.asyncIterator](): AsyncIterableIterator<IPoll.State<T, U, V>> {
  while (!this.isDisposed) {
    yield this.state;
    await this.tick.catch(() => undefined);
  }
}

Compiled with ES6 target

[Symbol.asyncIterator]() {
  return __asyncGenerator(this, arguments, function* _a() {
      while (!this.isDisposed) {
          yield yield __await(this.state);
          yield __await(this.tick.catch(() => undefined));
      }
  });

Compiled with ES2018 target

async *[Symbol.asyncIterator]() {
  while (!this.isDisposed) {
      yield this.state;
      await this.tick.catch(() => undefined);
  }
}

This case is particularly egregious but all uses of await are wrapped in the ES6 version and native in the ES2018 version. We use await extensively in the @lumino/application and @lumino/polling packages.


Please 👍 if you agree and 👎 if you disagree.

@afshin afshin added the question Further information is requested label Sep 1, 2022
@afshin afshin added this to the Lumino 2 milestone Sep 1, 2022
@afshin afshin changed the title Should we compile to ES2018? Should we compile to ES2018 in Lumino 2? Sep 1, 2022
@blink1073
Copy link
Member

Looking at the ECMAScript 2016+ compatibility table, it looks like among the browsers we support, async generators are available (and most other ECMAScript features to that point as well). The only limitation I see is that Safari is missing support for RegExp Lookbehind Assertions.

@afshin afshin mentioned this issue Sep 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants