You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using String Literal types to define classnames and would love to populate with some more information.
So basically:
typeTClassnames=/** Some docs about red-500 */|'bg-color-red-500'/** Some docs about red-600 */|'bg-color-red-600'
I would expect it to populate the docs on the right side of the intellisense:
This is how we can document with properties:
Which would be amazing to have on string literals.
I thought it was a TSDoc issue, but given this context: microsoft/tsdoc#164, it seems to be VSCode not parsing it... though then it seems to actually be Typescript related?
This is an underrated feature. Nowadays, a lot of enum are done using string literals - a powerful feature that puts Typescript above a lot of static languages. However, those enumerations lack proper documentation, which causes several problems.
<Textstyle={{color: 'blue',alignSelf: 'center',}}> This is a blue text </Text>
Adding string comments would simplify the understanding of each possibility (each color, each possible alignments).
This is applicable to all properties with a defined set of string values.
Configuration files
For example, let's take a tsconfig.json file:
{"module": "commonjs"}
Currently, the documentation looks like this:
While we know all the possible options, there is no way to understand what they actually do. String comments could tell explicitly the user what each option is supposed to change.
This is applicable to all configuration files that are made with TS, not only tsconfig.json.
Material-UI
Material-UI relies a lot on string enumerations, but they are not always easy to understand.
<Buttonvariant="contained"> My Button </Button>
In the above example, while variant is trivial to understand, it's not easy to guess what the "contained" value means. You have to rely on the external documentation, where that shouldn't be necessary.
This is applicable to all React props with a defined set of string values.
In conclusion, I think it's a very good idea, and it could simplify documentation in a lot of projects.
Reacted by Pierre Mouchan, Exymat, Muhammad Sammy, Patrick Fowler, Mo Doaie, Max Chang, Abhijeet Singh, Anurag Hazra, jjevtic, laurenceedge and 6 more
As I mentioned in multiple other issues, I really don't care for TS as all my development is in JS.
I just want to have proper documentation in situations like this:
It just happens that VSCode (and other tools) uses TSC behind the hood.
We often use string literal types as a lightweight alternative to full enums. It's really frustrating that we can't document the individual options in a way that VS Code recognizes. In the following code, all the doc-strings on the options are simply lost:
/** Controls the alignment of text when printed. */typeTextAlignment=/** Left-aligns the text. */|"left"/** Right-aligns the text. */|"right"/** Centers the text horizontally. */|"center";
There are identical issues in the TypeDoc repo (TypeStrong/typedoc#1710) and the TSDoc repo (microsoft/tsdoc#164), but they all require proper support from TypeScript first.
Reacted by Holger Jeromin, Paul Mölders, Michael Manzinger, Jon Wu, Mo Doaie, Vivian Mauer, Vitor Buzinaro, Max Chang, Anurag Hazra, Minh Quân Lê and 10 more
Is there any chance that this feature will be added to the plan? It would be extremely useful for many people and, in some cases, would make documentation possible in the first place due to a lack of alternatives.
Reacted by Eric Mika, Alexander Prokhorov, Einar Magnús Boson, Viktor Shchelochkov , anthony marquez and 知晓同丶
In the meantime, I built and published a VS Code extension for this that makes JSDoc comments in union types possible. Basically, the extension is just a wrapper around my TypeScript language plugin, which can also be used outside of VS Code but has to be enabled via the tsconfig. So far, comments can be displayed for function parameters and variables.
This is how it should look if active:
Feel free to give me feedback on how well this works for you 🙂
Activity
TheMrZZ commentedon Sep 16, 2020
This is an underrated feature. Nowadays, a lot of
enumare done using string literals - a powerful feature that puts Typescript above a lot of static languages. However, those enumerations lack proper documentation, which causes several problems.Here is the link of the related issue in the tsdoc repository.
Here are a few real-world use-cases I thought of:
React Native CSS
Adding string comments would simplify the understanding of each possibility (each color, each possible alignments).
This is applicable to all properties with a defined set of string values.
Configuration files
For example, let's take a
tsconfig.jsonfile:Currently, the documentation looks like this:

While we know all the possible options, there is no way to understand what they actually do. String comments could tell explicitly the user what each option is supposed to change.
This is applicable to all configuration files that are made with TS, not only
tsconfig.json.Material-UI
Material-UI relies a lot on string enumerations, but they are not always easy to understand.
In the above example, while
variantis trivial to understand, it's not easy to guess what the"contained"value means. You have to rely on the external documentation, where that shouldn't be necessary.This is applicable to all React props with a defined set of string values.
In conclusion, I think it's a very good idea, and it could simplify documentation in a lot of projects.
NemoStein commentedon Oct 16, 2020
As I mentioned in multiple other issues, I really don't care for TS as all my development is in JS.

I just want to have proper documentation in situations like this:
It just happens that VSCode (and other tools) uses TSC behind the hood.
phaux commentedon Oct 16, 2020
It would be nice if at least this was working (it doesn't):
DanielSWolf commentedon Jan 14, 2022
We often use string literal types as a lightweight alternative to full enums. It's really frustrating that we can't document the individual options in a way that VS Code recognizes. In the following code, all the doc-strings on the options are simply lost:
There are identical issues in the TypeDoc repo (TypeStrong/typedoc#1710) and the TSDoc repo (microsoft/tsdoc#164), but they all require proper support from TypeScript first.
vivianmauer commentedon Jan 10, 2023
Any update on this? 😕
laizp commentedon May 2, 2023
Any progress? It would be an amazing feature. 😕
cseas commentedon Jun 3, 2023
We also have this requirement for adding TSDoc for our design system tokens.
razorpay/blade#1249
Similar ask on StackOverflow:
https://stackoverflow.com/questions/63067208/writing-more-descriptive-intellisense-docs-for-typescript-union-types
For now, we're working around this limitation by providing the feature in a VSCode extension:
https://marketplace.visualstudio.com/items?itemName=cseas.razorpay-blade-intellisense
starball5 commentedon Jun 9, 2023
And a recent duplicate of the above linked Stack Overflow question: How can I get hover documentation for string literals matching documented union type members in JS/TS?
hylickipiotr commentedon Jan 3, 2024
Any updates?
Serveny commentedon Oct 20, 2025
Is there any chance that this feature will be added to the plan? It would be extremely useful for many people and, in some cases, would make documentation possible in the first place due to a lack of alternatives.
douglasg14b commentedon Nov 3, 2025
This issue will be in 1st grade soon!
This is an incredibly valuable developer experience item.
Serveny commentedon Dec 26, 2025
In the meantime, I built and published a VS Code extension for this that makes JSDoc comments in union types possible. Basically, the extension is just a wrapper around my TypeScript language plugin, which can also be used outside of VS Code but has to be enabled via the tsconfig. So far, comments can be displayed for function parameters and variables.
This is how it should look if active:
Feel free to give me feedback on how well this works for you 🙂