Skip to content

Update static styles getter to static field #34

@justinfagnani

Description

@justinfagnani

I see some patterns like this:

  static get styles() {
    return css`
      label,
      input {
        cursor: pointer;
      }
    `;
  }

Because you're using TypeScript you can write this with standard JS field syntax:

  static get styles = css`
    label,
    input {
      cursor: pointer;
    }
  `;

It's a little nicer to read and has slightly better performance in inheritance use-cases (in Lit 2 at least).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions