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

ignored variables in @property decorator #283

Open
scottnath opened this issue Nov 14, 2024 · 0 comments
Open

ignored variables in @property decorator #283

scottnath opened this issue Nov 14, 2024 · 0 comments

Comments

@scottnath
Copy link

When using a variable to declare an attribute of a property, the variable is ignored.

playground reproduction

this class:

import { LitElement } from 'lit-element';

const meow = 'meow-meow'

export class MyElement extends LitElement {
  static get properties() {
    return {
      fooFoo: { type: String, attribute: 'foo-foo' },
      meowMeow: { type: String, attribute: meow }
    }
  }
  ...

Ends up with these attributes:

  "attributes": [
    {
      "name": "foo-foo",
      "type": {
        "text": "string"
      },
      "fieldName": "fooFoo"
    },
    {
      "name": "meowMeow",
      "type": {
        "text": "string"
      },
      "fieldName": "meowMeow"
    }
  ],

Expected behavior

The variable should be processed to get the correct name of the attribute:

  "attributes": [
    {
      "name": "foo-foo",
      "type": {
        "text": "string"
      },
      "fieldName": "fooFoo"
    },
    {
      "name": "meow-meow",
      "type": {
        "text": "string"
      },
      "fieldName": "meowMeow"
    }
  ],

thanks for any help,
Scott

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

No branches or pull requests

1 participant