How to properly document (TSDoc) exported classes

A.ts

/**
* The A Class
*/
export class A {}
export default A

The Alphabet Namespace(?)

Alphabet.ts

import A from "./"
import B from "./"
import C from "./"
/**
* Collection of letters
*/
export const Alphabet = {
 A,
 B,
 C
}
export default Alphabet

This allows you to use the library like:

import MyLibrary from "x"

const letter = new MyLibrary.Alphabet.A

The problem

The documentation you see in A.ts does not persist over once it has been exported in Alphabet.ts

If you hover over import A from "./" you will see The A Class. But if you hover over A here:

export const Alphabet = {
 A,
 B,
 C
}

You will see no documentation which of course means you see nothing when you utilize it as an end-user here: MyLibrary.Alphabet.A

It seems you could fix this, but the documentation must be moved from A.ts to where it is exported in Alphabet.ts, which is not ideal from a developer standpoint, though this works for users.



from Recent Questions - Stack Overflow https://ift.tt/3npf8HA
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation