Quick fix to convert @typedef to type or interface
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- javascript, typescript
- Domaine
- compilers
Piste de recherche
L’issue ne fournit aucun fichier du dépôt, test ni point d’entrée. Commencez par examiner l’architecture de quick-fix de TypeScript et les codefixes existants liés à JSDoc, puis déterminez la conversion attendue pour l’exemple @typedef présenté. C’est terminé lorsqu’un quickfix convertit les typedefs JSDoc pris en charge en un type ou une interface sans modifier la sortie à l’exécution.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Search Terms
typedef quickfixtypedef jsdoc
Suggestion
I have lots of code in an old Closure Compiler-style project that looks like this:
/**
* @typedef {{
* px: number,
* py: number,
* isZooming: boolean,
* isPanning: boolean,
* is2DPan: boolean,
* cancelNextDblclick: boolean,
* initializeMouseDown: (e: !Event, dygraph:!DygraphAny, context: !DygraphInteractionContext) => void
* }} DygraphInteractionContext
*/
If I declare a variable with this type, I can see that TypeScript understands the @typedef:
type DygraphInteractionContext = {
px: number;
py: number;
isZooming: boolean;
isPanning: boolean;
is2DPan: boolean;
cancelNextDblclick: boolean;
initializeMouseDown: (e: Event, dygraph: any, context: ...) => void;
}
I'd like to convert this to a type or interface. I can introduce a dummy variable, copy the TS-style type declaration and paste it in to do the conversion.
But it'd be easier if there were a quickfix!
Use Cases
Migrating a project that used JSDoc-based typing. A workaround is available, but a quickfix would be a big improvement.
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.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.4k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 117
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.
Autres issues de microsoft/TypeScript
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
microsoft/TypeScript#64322 · 2 commentaires · 1 réaction · 2 personnes assignées ·
-
Possible Improvement
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
microsoft/TypeScript#64278 · 1 commentaire · 1 réaction ·
-
Docs
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
microsoft/TypeScript#64118 · 1 commentaire ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
microsoft/TypeScript#64094 ·
-
Docs
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
microsoft/TypeScript#63959 · 5 commentaires ·
Toutes les issues de microsoft/TypeScript
Issues similaires
-
optimization optimization:agents-md-curator
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
blinklabs-io/bursa#904 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 commentaires ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 90/100