open-wc / custom-elements-manifest

Custom Elements Manifest is a file format that describes custom elements in your project.
https://custom-elements-manifest.open-wc.org/
225 stars 37 forks source link

getDefaultValuesFromConstructorVisitor make incorrect fields in class members #210

Open elasim opened 1 year ago

elasim commented 1 year ago

Checklist

Completing the items above will greatly improve triaging time of your issue.

Reproduction URL: https://custom-elements-manifest.netlify.app/?source=CmNsYXNzIE15RWxlbWVudCBleHRlbmRzIEhUTUxFbGVtZW50IHsKICAjZGF0YSA9IG5ldyBjbGFzcyBleHRlbmRzIFNvbWVXSGVyZSB7CiAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgdGhpcy5maWVsZElzTm90TWVtYmVyT2ZNeUVsZW1lbnQgPSAwOwogICAgICB9CiAgfQogIHN0YXRpYyBnZXQgb2JzZXJ2ZWRBdHRyaWJ1dGVzKCkgewogICAgcmV0dXJuIFsnZGlzYWJsZWQnXTsKICB9CgogIHNldCBkaXNhYmxlZCh2YWwpIHsKICAgIHRoaXMuX19kaXNhYmxlZCA9IHZhbDsKICB9CiAgZ2V0IGRpc2FibGVkKCkgewogICAgcmV0dXJuIHRoaXMuX19kaXNhYmxlZDsKICB9CgogIGZpcmUoKSB7CiAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IEV2ZW50KCdkaXNhYmxlZC1jaGFuZ2VkJykpOwogIH0KfQoKY3VzdG9tRWxlbWVudHMuZGVmaW5lKCdteS1lbGVtZW50JywgTXlFbGVtZW50KTsK&library=vanilla

Expected behavior A clear and concise description of what you expected to happen.

fieldIsNotMemberOfMyElement should not be part of the members declared in MyElement.

In my opinion, if node.kind is ts.SyntaxKind.PropertyDeclaration at the following location, ts.forEachChild should not be executed.

https://github.com/open-wc/custom-elements-manifest/blob/bcf58fdd84267c98eeda7ad244cc85bb8be5536b/packages/analyzer/src/features/analyse-phase/creators/createClass.js#L224