microsoft / microsoft/TypeScript
JSDoc type aliases aren't parsed or bound at the end of blocks
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
Bug Report
Followup to #54037 and #53624
This is not a regression, and fixing it would require
- the parser to check for jsdoc before each close brace
- the ast to store optional jsdoc on each close brace, and store the close brace on each block
- the binder to visit each close brace to check for jsdoc to bind
So I think it's too expensive for a feature that nobody has noticed missing until recently.
🔎 Search Terms
JSDoc type alias ignored
🕗 Version & Regression Information
- This is the behavior in every version I tried
💻 Code
// @filename: typedefAtEndOfBlock.js
// @checkJs: true
// @outdir: dist
// @declaration: true
function f() {
/* @type {A} */
var a = 2
/** @typedef {string} A */
}
{
/* @type {B} */
var b = 2
/** @typedef {string} B */
}
export class Class {
/* @type {C} */
c = 1
/** @typedef {string} C */
}
const Dlass = class {
/* @type {D} */
d = 1
/** @typedef {string} D */
}
🙁 Actual behavior
None of the typedefs are parsed or bound.
🙂 Expected behavior
The typedefs are parsed and bound.
(And none are visible outside their containers, which is not true for classes right now).
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la riproduzione in typedefAtEndOfBlock.js e traccia il modo in cui parser, AST e binder gestiscono JSDoc prima delle parentesi graffe di chiusura. Confronta il comportamento descritto in #54037 e #53624. Il lavoro è completo quando i typedefs vengono analizzati e associati all'interno dei rispettivi contenitori e viene affrontato il comportamento documentato di visibilità di class.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100