Giter Site home page Giter Site logo

Comments (4)

ajafff avatar ajafff commented on May 18, 2024

I think you mixed up VariableStatement and VariableDeclarationList in your example.
VariableDeclarationList never has any JSDoc, because it is located on the VariableStatement.

This function is not intended to find the JSDoc on any parent node. It's just a thin wrapper to make the internal property Node.jsDoc available to use in your program.
TypeScript never parses JSDoc on VariableDeclaration or VariableDeclarationList. You need to take care of passing the correct node to the function.

If there is the need for a function that retrieves JSDoc for a node the way TypeScript does, I can probably add that on top.

from tsutils.

JoshuaKGoldberg avatar JoshuaKGoldberg commented on May 18, 2024

Yes and yes. The context is TSLint's completed-docs function.

from tsutils.

ajafff avatar ajafff commented on May 18, 2024

@JoshuaKGoldberg what would the ideal API look like?

You throw in any Node / (Named)Declaration and get back the JSDoc TypeScript would use?
Should it automatically search for JSDoc on the opposite property accessor?

from tsutils.

JoshuaKGoldberg avatar JoshuaKGoldberg commented on May 18, 2024

IMO yes, but with the caveat that it only looks at the single file (no class inheritance checks or the like). Other than that get/set edge case, and parsing through variable statement/declaration/declaration lists, I can't think of other edge cases.

from tsutils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.