Giter Site home page Giter Site logo

Comments (8)

trusktr avatar trusktr commented on August 25, 2024 4

FWIW, one can write a tsdoc comment on the props property, which links to the Props interface, and the docs for that interface can have all the info.

from tsdoc.

octogonz avatar octogonz commented on August 25, 2024 3

FYI this summer we are planning to enable API Extractor analysis for the office-ui-fabric-react library, which is a collection of React controls.

As far as I know, a documentation tool can model React controls as ordinary TypeScript classes and interfaces. If there are specific TSX features that you think would need special handling in the doc comment syntax, this would be in scope for TSDoc.

from tsdoc.

TomasHubelbauer avatar TomasHubelbauer commented on August 25, 2024

React components are initialized based on a call toReact.createElement, not by doing new MyComponent (at least not explicitly) or myComponent.prop = 'value' so what documentation fields exactly should be generated where? React.createElement will pick up the props type/interface in its second argument, so TSDoc you place on the props type's/interface's members will show up in Intellisense there.

Can you give an example of what would be generated based on the code you provided so far?

from tsdoc.

yuqingc avatar yuqingc commented on August 25, 2024

possibly something like this.

Props Type Requied Description
name string yes Some descriptioin

or something JavaScript object like this

{
    propName: "name",
    type: "string",
    isRequired: true,
    default: "Someone",
    description: "..."
}

@TomasHubelbauer

from tsdoc.

TomasHubelbauer avatar TomasHubelbauer commented on August 25, 2024

But where? On the component class? On its constructor? Or do you have in mind generating documentation files (for example MarkDown) form TSDoc documentation comments?

from tsdoc.

yuqingc avatar yuqingc commented on August 25, 2024

Generating markdown would be nice. ref: like jsdoc-to-markdown

But where? On the component class? On its constructor? Or do you have in mind generating documentation files (for example MarkDown) form TSDoc documentation comments?

from tsdoc.

TomasHubelbauer avatar TomasHubelbauer commented on August 25, 2024

Now I understand. I think that's out of the scope for TSDoc itself (similarly to your link being a tool on top of JSDoc not a feature of JSDoc itself). Perhaps it would be good to ask jsdoc-to-markdown if they will add support for TSDoc.

from tsdoc.

octogonz avatar octogonz commented on August 25, 2024

Closing this because it seems like the questions were answered. Feel free to reopen if anyone wants to continue the discussion.

from tsdoc.

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.