When using typeof for the interface, it is hoped that the jsdoc comments of the expression can inherit typeof by default
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- javascript, typescript
- Domaine
- compilers
Piste de recherche
Reproduisez les exemples avec JSDoc1 sur test, puis comparez les commentaires manquants sur testInInterface et test2.test. La modification est terminée lorsque les commentaires issus d’une expression typeof sont hérités à la fois dans les cas d’interface et d’accès à une propriété, sans nécessiter JSDoc2 ni JSDoc3.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
🔍 Search Terms
"typeof","jsdoc"
✅ Viability Checklist
- 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, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
/** JSDoc1 */
const test = { a: 0 }
declare module 'vue' {
interface ComponentCustomProperties {
/** JSDoc2 */
testInInterface: typeof test,
}
}
const test2 = {
/** JSDoc3 */
test
}
I hope that when not writing JSDoc2 or JSDoc3, testInInterface and test2.test can have comments for const test in JSDoc1
📃 Motivating Example
The interface has the feature of declaring and merging, allowing developers to extend the interfaces defined in the component library. In front-end development, extending Vue's global components, directives, and properties is often used.
Taking a Vue component as an example, including its global and local usage schemes, there is currently a lack of JSDoc comments
- global
import vueComponentWithJsDoc from './test.vue'
declare module 'vue' {
interface GlobalComponents {
vueComponentWithoutJsDoc: typeof vueComponentWithJsDoc
}
}
- local
import vueComponentWithJsDoc from './test.vue'
import { defineComponent } from 'vue'
export default defineComponent({
components: { vueComponentWithoutJsDoc: vueComponentWithJsDoc }
})
When using components in the template, both of the above schemes lack JSDoc comments
<template>
<vue-component-without-js-doc />
</template>
💻 Use Cases
- JSDoc comments can be included when declaring a merge interface
- The type obtained by the typeof instance is missing the jsdoc annotation
- Manually copy a jsdoc comment onto the interface field
- 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