open-wc / custom-elements-manifest

Custom Elements Manifest is a file format that describes custom elements in your project.

Home Page:https://custom-elements-manifest.open-wc.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong parse Object from AST

next-juanantoniogomez opened this issue · comments

Checklist

  • Did you run the analyzer with the --dev flag to get more information?
  • Did you create a minimal reproduction in the playground?

Expected behavior

I have a Lit component (no Typescript) and the constructor assigns a default value to a property. If the value is an object, it is parsed as String instead of Object:

  constructor() {
    super();

    // In the manifest, 'default' value should be "{ foo: 'bar' }" (JSON-stringified),
    // not "{\n        foo: 'bar'\n    }"
    this.foo = {
        foo: 'bar'
    };
  }
"members": [
  {
    "kind": "method",
    "name": "myMethod"
  },
  {
    "kind": "field",
    "name": "foo",
    "privacy": "public",
    "type": {
      "text": "object"
    },
    "description": "Foo value",
    "default": "{\n        foo: 'bar'\n    }",
    "attribute": "foo"
  }
],
"attributes": [
  {
    "name": "foo",
    "type": {
      "text": "object"
    },
    "description": "Foo value",
    "default": "{\n        foo: 'bar'\n    }",
    "fieldName": "foo"
  }
],

In the AST explorer, the object appears as ObjectLiteralExpression, so it could be proccessed as Object.

this should be fixed in 0.10.1