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/
227 stars 37 forks source link

Supply method return type in JSON via inference #159

Open dave52 opened 2 years ago

dave52 commented 2 years ago

Hello -

This is a feature request more than a bug. It would be nice if methods inferred their return type (like TS does) but supplied this info in the .json.

As it exists, methods require an explicit return type to be added, or JSdocs style @returns info.

Existing

sayHello(): string { 
  return 'hello'; 
}

Desired

sayHello() { 
  return 'hello'; 
}

JSON Output

{
  "kind": "method",
  "name": "sayHello",
  "return": {
    "type": {
      "text": "string"
    }
  }
},

BTW this CEM package is great, thank you for your efforts ♥