microsoft / microsoft/TypeScript

JSDoc optional/required variant doesn't play well with multi-@param RecordType declarations

Aperta
#23,397 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Bug Domain: JavaScript Domain: JSDoc
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

TypeScript Version: 2.9.0-dev.20180330

Search Terms: as mentioned in this comment, I'm opening this issue because with this JSDoc syntax typescript doesn't recognize the params correctly.

Code

// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.

/**
 * @param {!object} args 
 * @param {!string} args.prop1
 * @param {?string} args.prop2
 */
function patate(args) {
  const { prop1, prop2 } = args;
} 

Expected behavior: No errors

Actual behavior: With allowJs and checkJs, I get JSDoc '@param' tag has name 'prop1', but is no parameter with that name.

Playground Link:

Related Issues: https://github.com/Microsoft/TypeScript/issues/19645

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con l’esempio JavaScript autonomo nell’issue ed esegui tsc con allowJs e checkJs abilitati. Verifica come il compilatore gestisce la dichiarazione JSDoc con più @param; il lavoro è completato quando l’esempio non produce alcuna diagnostica per args.prop1 o args.prop2.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
compilers
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.