microsoft / microsoft/TypeScript
Parameters typed as `unknown` even when the function type has the correct 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
mapped types, function types
🕗 Version & Regression Information
- This is the behavior that starts in version 4.9, and I reviewed the FAQ for entries about function types
All the versions prior to 4.9 have both scenarios with the params typed tounknown
⏯ Playground Link
💻 Code
No response
🙁 Actual behavior
The function with no default shows the proper function type but the parameters are typed as unknown
🙂 Expected behavior
The parameters should have the types of the function params
Additional information about the issue
There is also a smaller reproduction that was made by mkantor on discord.
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 le due riproduzioni collegate di TypeScript Playground e confronta il comportamento dell'inferenza dei parametri nelle versioni segnalate. Traccia l'inferenza coinvolta di Mapped-Type e Function-Type, quindi conferma che i parametri ricevono i tipi dichiarati della funzione invece di unknown in entrambi gli scenari.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100