angular / dgeni-packages

A collection of dgeni packages for generating documentation from source code.
MIT License
142 stars 106 forks source link

Types of accessors are not resolved propery #246

Closed devversion closed 6 years ago

devversion commented 6 years ago

Hey there,

With the recent changes to more object orientated documents, the types for accessors are no longer resolved properly.

class MdButton {

  get checked(): boolean { return this._checked;  }
  set checked(value) {
    this._checked = value;
  }
}

Also those getters and setters are being treated as functions, while they theoretically can be considered as properties of the class.

This means that right now we need to manually determine the types of the accessors in our Dgeni package.

The issue here is, that the members of the class may exist twice and the type of the "property" can be defined in two different places. Either in the getter or in the setter as a first parameter.

petebacondarwin commented 6 years ago

Can you not use the isGetAccessor and isSetAccessor on the docs? See https://github.com/angular/dgeni-packages/blob/master/typescript/src/api-doc-types/MemberDoc.ts

devversion commented 6 years ago

Good point, I saw those two properties on the MemberDoc class. The problem I had, was that I only got one document for the getter and setter.

This document then just had both isGetAccessor and isSetAccessor set to true, and didn't have a type specified either.

petebacondarwin commented 6 years ago

Good spot, it is a bit buggy. Let me come up with a fix.

petebacondarwin commented 6 years ago

I have created a PR which should solve this problem... #247

devversion commented 6 years ago

@petebacondarwin Thanks! I will try to give it a shot this today/tomorrow. Will keep you updated.