microsoft / microsoft/TypeScript
JSDoc: Typescript is interpreting varargs in function signature as required argument if jsdoc function notation is used in typedef.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
TypeScript Version: typescript@3.4.0-dev.20190308
Search Terms: jsdoc, varargs, typedef,
Code
// if I want to use typescript format
// this format is not supported by WebStorm
/** @typedef {(...a2:Array<string>) => void} A */
/** @type {A} */
let a;
a(); // but this works fine with typescript
// if I want to use JSDoc format
// this format is supported by WebStorm
/** @typedef {function(...string):void} B */
/** @type {B} */
let b;
b(); // but this not work, TS2555: Expected at least 1 arguments, but got 0
Expected behavior:
Both formats should be interpreted in same way.
Actual behavior:
test.js:13:1 - error TS2555: Expected at least 1 arguments, but got 0.
13 b(); // but this not work, TS2555: Expected at least 1 arguments, but got 0
~~~
test.js:10:24
10 /** @typedef {function(...string):void} B */
~~~~~~~~~
An argument for '0' was not provided.
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 minima in JavaScript nell'issue e confronta il modo in cui TypeScript gestisce le due forme di typedef JSDoc, concentrandoti sul parametro varargs e sulla diagnostica TS2555. Il lavoro è completato quando entrambe le forme consentono di chiamare la funzione risultante senza argomenti, con test che coprono il comportamento equivalente.
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
- Abbastanza chiara
- Idoneità per principianti
- 38/100