microsoft / tsdoc

A doc comment standard for TypeScript
https://tsdoc.org/
MIT License
4.7k stars 130 forks source link

Does JSDoc === TSDoc from a type checking perspective? #311

Open johnnyreilly opened 2 years ago

johnnyreilly commented 2 years ago

Hey all!

I've been a happy user of JSDoc to power type checking with TypeScript in JS files.

https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html

I'm curious to understand what the relationship of TSDoc is / could be to powering the type checking. Will TSDoc just work™️ in the same way JSDoc does?

Forgive me if this is a silly question, I'm new to TSDoc and I haven't seen anything in the current docs / issues that discusses this.

orta commented 2 years ago

@johnnyreilly might know the answer by now, but this came up in the ts discord. tsdoc is a well-specified standardization of JSDoc so that many tools can build on it and share tooling. Think how commonmark fixed up a lot of problems in markdown.

The TypeScript parser for JSDoc is entirely enclosed inside TypeScript and is both a subset of jsdoc's syntax and more when it needs to be. There's no connection between the the jsdoc system in TS and tsdoc other than we'd check if tsdoc for syntax ideas if there wasn't something in jsdoc already