/* source/add.ts */
/**
* Adds two numbers.
*
* @param x - First number.
* @param y - Second number
* @returns The sum of x and y.
*/
const add = (x: number, y: number): number => x + y
The key benefit to have such ability is to have a single source of example without any duplications to be able to present it in a multiple ways simultaneously, like running it and listing its source at the same time.
For example,
Here's the source file:
Here's the example source file:
Is there a way to reference the example source file in TSDoc?
Ideally via something like this:
The key benefit to have such ability is to have a single source of example without any duplications to be able to present it in a multiple ways simultaneously, like running it and listing its source at the same time.