microsoft / microsoft/TypeScript
Display default values for property types.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔎 Search Terms
- jsdoc property and default tooltip
- jsdoc declare default values on object properties
- use jsdoc property with default
🕗 Version & Regression Information
Unsure if it's always been this way.
⏯ Playground Link
💻 Code
/**
* @typedef {object} Props
* @property {'sm' | 'md' | 'lg'} [Props.size='md'] Button size.
* @property {string} [Props.label] Button label.
*/
/**
* @returns {Props}
* @default { size: 'md', label: undefined }
*/
function getProps() {
return {}
}
let { size = 'md', label } = getProps()
🙁 Actual behavior
Tooltip when hovering size destructured property:
let size: "sm" | "md" | "lg"
Button size.
🙂 Expected behavior
Tooltip when hovering size destructured property:
let size: "sm" | "md" | "lg"
Button size.
---
@default 'md'
Additional information about the issue
Potentially relates to https://github.com/microsoft/TypeScript/issues/24746
When defining object property types using JSDoc default value notation, such as @property {'sm' | 'md' | 'lg'} [Props.size='md'], I'd like to see tooltip details about the default value. I assume the only way to denote default values with @property is to use [key=value] notation since @default cannot be inlined.
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 il TypeScript Playground collegato e riproduci il caso del valore predefinito JSDoc @property, quindi confrontalo con l’issue correlata 24746. Traccia come viene prodotto il tooltip della size destrutturata e fai in modo che il comportamento completato mostri il valore predefinito documentato, ad esempio @default 'md'.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- compilers, developer-experience
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 52/100