Daryl
Daryl

Reputation: 18895

How To Stub TypeScript Function Comments?

I'm running VS2013 and I'm just getting started with TypeScript.

I have Web Essentials 2013.5 and DocStubJs installed. Currently when I'm writing my javascript, I use the C#-ish function comments auto created by DocStubJs: enter image description here

I did this mainly because the DocStubJs stubbed out the Comments for me. It (I'm assuming it's DocStubJS doing it) even works in TypeScript as well, and I just started using it since it was familiar and was what most of the code was in anyways. But after looking at more documentation for Typescript, I see they use the JsDoc formatting:

    /**
     * Does stuff
     *
     * @param blah stuff needing done
     */
    public doStuff(blah: string) {}

Which formatting should I use, the XML-ish commenting, or the DocJs? If I go the DocJs route, is there anyway to be able to stub out the comments automagically?

Upvotes: 0

Views: 1363

Answers (2)

zhengbli
zhengbli

Reputation: 712

Update 9/25/15: the better JsDoc scaffolding is added to the TypeScript master today in https://github.com/Microsoft/TypeScript/pull/4978. If you feel adventurous you are welcome to clone the repo, enable VS dev mode, and use it today. :)

Go with the JsDoc route. The TypeScript team is adding support for JsDoc for the upcoming releases, which including the type information, intellisense and scaffolding. With TS 1.6 beta, The scaffolding now works with functions. More support would likely be added in the future.

Upvotes: 1

Daryl
Daryl

Reputation: 18895

Use JsDocs since XML Commenting doesn't work with intellisense for Method overloading in TypeScript

Also just figured out that typing /** will stub out the JsDoc Comments for you.

Upvotes: 2

Related Questions