Skip to content

How to document each type in `export type Foo = 'foo1' | 'foo2'? #2585

@ibc

Description

@ibc

Question

Basically I need those 'foo1' and 'foo2'. being documented:

/**
 * Foo valid values.
 */
export type Foo =
	/**
	 * Doc of foo1.
	 */
	| 'foo1'
	/**
	 * Doc of foo2.
	 */
	| 'foo2';

However generated docs look like this (documentation about 'foo1' and 'foo2' is not parsed/included):

CleanShot 2024-06-03 at 17 54 01@2x

I know that I could make it "work" by doing this complex thing:

/**
 * Doc of foo1.
 */
export type Foo1 = 'foo1';

/**
 * Doc of foo2.
 */
export type Foo2 = 'foo2';

/**
 * Foo valid values.
 */
export type Foo = Foo1 | Foo2;

It would produce this:

CleanShot 2024-06-03 at 17 55 23@2x
CleanShot 2024-06-03 at 17 55 41@2x
CleanShot 2024-06-03 at 17 55 49@2x

But this is definitely too complex and definitely not desirable at all. Having to click on each type to see how a string looks is too much. Do I miss something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions