Skip to content

Support JSDoc on class / obj. literal getters#7309

Merged
RyanCavanaugh merged 3 commits into
microsoft:masterfrom
RyanCavanaugh:fix6878
Mar 3, 2016
Merged

Support JSDoc on class / obj. literal getters#7309
RyanCavanaugh merged 3 commits into
microsoft:masterfrom
RyanCavanaugh:fix6878

Conversation

@RyanCavanaugh

Copy link
Copy Markdown
Member

Fixes #6878

@DanielRosenwasser

Copy link
Copy Markdown
Member

Can you add a test for setters too?

1 similar comment
@DanielRosenwasser

Copy link
Copy Markdown
Member

Can you add a test for setters too?

@RyanCavanaugh

Copy link
Copy Markdown
Member Author

We're not supporting JSDoc on setters

//// } catch (x) { x--; }
//// return 23;
//// let x = {
//// /** This is cool*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you specify the type for getters, same as you can with variables? i.e.

/** This is cool
  * @type {Element}
  */
  get m() { return elementFactory(); }
}

Comment thread src/compiler/checker.ts
const setter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.SetAccessor);

if (getter.flags & NodeFlags.JavaScriptFile) {
const jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the param type of the setter function, we do this in TS..

RyanCavanaugh added a commit that referenced this pull request Mar 3, 2016
Support JSDoc on class / obj. literal getters
@RyanCavanaugh RyanCavanaugh merged commit 311f8dd into microsoft:master Mar 3, 2016
@RyanCavanaugh RyanCavanaugh deleted the fix6878 branch March 3, 2016 23:50
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants