microsoft / microsoft/TypeScript
Inline tsdoc comment support
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.3k
- Merge moyen
- 2 j 4 h
- PR mergées (30 j)
- 132
Description
Search Terms
tsdoc, comments, IDE, line sorting
Suggestion
When writing a type, sometimes you want to add more information to a field that will be surfaced in IDE autocomplete. Currently you must define them like this:
export type BoxSizeDefinition = {
/** this is null for non-custom box sizes */
itemCount: number | null
size: BoxSize
/** A description for the range of pounds included in box. */
poundage: string
/** price in cents of the box size */
price: number
}
Note that the comment is above the field. This is problematic because auto-sorting linters and such will mangle the comments.
I propose also supporting inline tsdoc comments:
export type BoxSizeDefinition = {
itemCount: number | null /** this is null for non-custom box sizes */
size: BoxSize
poundage: string /** A description for the range of pounds included in box. */
price: number /** price in cents of the box size */
}
This effectively fixes the sorting problem.
Use Cases
Adding descriptive text to be shown via IDE autocomplete for fields (currently supported, but not in a sorting & codeaction-friendly way.)
Examples
See above
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par examiner les exemples de types TypeScript proposés et le cas d’utilisation indiqué pour TSDoc et IDE-autocomplete. Déterminez le comportement du parser, de la gestion des commentaires et de l’éditeur qui est affecté, puis définissez des tests montrant que les commentaires inline sont associés aux champs corrects sans modifier la sortie à l’exécution.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- compilers, developer-experience
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 30/100