question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Coexistence with the compiler's JSDoc-in-JavaScript feature

See original GitHub issue

I’m moving @seanpoulter 's question into its own issue:

What’s the long term plan for TSDoc? Will we be able to use it to annotate vanilla JavaScript like the current JSDoc support? In those cases the it’s crucial to be able to declare an interface in the comments or document @param properties.

Some background: The TypeScript compiler allows plain *.js files to be compiled alongside with *.ts files, and it will parse certain JSDoc type annotations and incorporate them into the type system.

Some design questions:

  • Beyond the TSDoc design goal of maintaining the look+feel of JSDoc (and CommonMark), does JSDoc-in-JavaScript imply any special considerations for TSDoc syntax?

  • Would TSDoc and JSDoc-in-JavaScript really need to be parsed by the same documentation pipeline? (Or are will the *.js files generally be legacy libraries or third-party dependencies?)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
octogonzcommented, Oct 21, 2018

@mike-north pointed me to this listing of JSDoc tags that are supported by the TypeScript compiler for type analysis:

https://github.com/Microsoft/TypeScript/wiki/JSDoc-support-in-JavaScript

We should definitely include these in TSDoc’s standard set of tags.

7reactions
octogonzcommented, Jun 22, 2018

BTW when we chatted with the compiler owners, they cautioned us against fostering an unnecessary tribal boundary between “JavaScript files” and “TypeScript files”. What if someone works in TypeScript but also has a lot of legacy JavaScript code that they can’t migrate overnight? Should they really have to learn two different doc comment syntaxes (and possibly two different documentation tools), and constantly switch between them depending on which file they’re editing? If TSDoc-in-JavaScript was modeled as a set of custom extensions for recording type information, then you could use one tool and syntax to work on both kinds of files.

This is probably out of scope for the first release. And I’m not sure to what extent someone would be authoring lots of new API documentation for their non-migrated files. But it made me think that where possible, the TSDoc design should try to anticipate and provide for this possible direction.

Read more comments on GitHub >

github_iconTop Results From Across the Web

9. What Compilers Can and Cannot Do - YouTube
MIT 6.172 Performance Engineering of Software Systems, Fall 2018Instructor: Tao B. SchardlView the complete course: ...
Read more >
New/Changed Features Common To The Compilers
Describes the new and changed features in the compilers and tools with this Oracle Solaris Studio release. Also includes information about known problems...
Read more >
What is a compiler? - TechTarget
A compiler that supports the source programming language reads the files, analyzes the code, and translates it into a format suitable for the...
Read more >
Compilers - MATLAB & Simulink - MathWorks
Supported and Compatible Compilers - Windows. A number of MathWorks products or product features require that you have a third-party compiler installed on...
Read more >
Compiler - Wikipedia
In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found