Skip to content

Restore target:esnext to samples tsconfig #582

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

Merged
merged 1 commit into from
Nov 2, 2021
Merged

Conversation

aomarks
Copy link
Member

@aomarks aomarks commented Nov 2, 2021

Fixes a regression from #560 where we accidentally dropped from "target": "esnext" to "target": "es2020" in the tsconfig.json for sample files (I made a common tsconfig.base.json which defaults to es2020 but forgot to override that in the samples one). We want esnext output for samples because we want to emit standard static class fields (note that @lit/ts-transformers switches instance class field initializers to be constructor-initialized if they are decorated with @property, to avoid that incompatibility).

Current regressed state:

import {LitElement, html} from 'lit';

class NameTag extends LitElement {
  render() {
    return html`Hello I'm ${this.name}.`;
  }
}
NameTag.properties = {
  name: {},
};
customElements.define('name-tag', NameTag);

With fix:

import {LitElement, html} from 'lit';

class NameTag extends LitElement {
  static properties = {
    name: {},
  };

  render() {
    return html`Hello I'm ${this.name}.`;
  }
}
customElements.define('name-tag', NameTag);

@aomarks aomarks requested a review from justinfagnani November 2, 2021 03:44
@github-actions
Copy link

github-actions bot commented Nov 2, 2021

A live preview of this PR will be available at the URL(s) below.
The latest URL will be appended to this comment on each push.
Each build takes ~5-10 minutes, and will 404 until finished.

https://pr582-4060955---lit-dev-5ftespv5na-uc.a.run.app/

@aomarks aomarks merged commit 219d80a into main Nov 2, 2021
@aomarks aomarks deleted the js-statics-issue branch November 2, 2021 03:55
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.

2 participants