open-wc / custom-elements-manifest-deprecated

Custom Elements Manifest is a file format that describes custom elements in your project.
8 stars 4 forks source link

[core] add simple TS types for variables and fields #24

Closed thepassle closed 3 years ago

thepassle commented 3 years ago

For fields and variables we can already add the 'simple' TS type by getting the: node.type.getText()

See: https://astexplorer.net/

Fixture:

class MyElement extends HTMLElement {
  foo: string = ''
}

customElements.define('my-element', MyElement);

Click on foo in the left panel of AST explorer, set compiler to typescript, and you'll see a type property in the PropertyDeclaration that you can call .getText() on

image