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.

Way to expand type aliases when auto generating docs

See original GitHub issue

The problem

When Styleguidist is generating docs from Typescript annotations for component props, it does not expand type aliases and thus displays the Type name (i.e., TSomeThing). This is an issue because it requires the user to open up the code and track down the type declaration to figure out the prop’s actual type.

Proposed solution

It would be great if Styleguidist could automatically expand Type aliases at least one level. So, for example the following type declaration:

type TSomeThing = 'option1' | 'option2' | 'option3'

Would show up as 'option1' | 'option2' | 'option3' in Styleguidist instead of just TSomeThing.

It probably shouldn’t expand beyond the first level to prevent large or recursive objects from causing issues, but it could also be useful to be able to specify the number of levels to expand.

Alternative solutions

A way to override the automatically generated type would be a good alternative. It’s just not very useful for our designs to see TSomeThing when reviewing our components.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
hamilr2commented, Sep 2, 2020

Hello,

I wanted to add a couple additional similar use cases to this issue that my team encountered when working with TS Vue with Class Components + Storybook argsTable (via vue-docgen-api):

  • When using inline ad-hoc types, for example @Prop() styleObject!: { [key: string]: string };, the result is TSTypeLiteral.
  • When using arrays of TS interfaces, for example @Prop() frameConfig!: FrameConfigInterface[], the result is Array rather than the expected FrameConfigInterface[].

If these are sufficiently different issues, I can file a separate issue.

0reactions
stale[bot]commented, Nov 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Advanced Types
Type aliases create a new name for a type. Type aliases are sometimes similar to interfaces, but can name primitives, unions, tuples, and...
Read more >
Opaque Type Aliases - Scala 3 - EPFL
Opaque types aliases provide type abstraction without any overhead. ... Double object Logarithm: // These are the two ways to lift to the...
Read more >
Does TypeScript allow type aliases?
From version 1.4 Typescript supports type aliases (source). Type Aliases. You can now define an alias for a type using the type keyword:...
Read more >
Options
typedoc --out path/to/documentation/ path/to/typescript/project/index.ts ... TypeDoc processes to generate documentation and how the files are processed.
Read more >
All About Type Aliases in Kotlin
Type aliases can be a great way to take complex, verbose, and abstract types and give them simple, concise, and domain-specific names. They're ......
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