microsoft / microsoft/TypeScript

Parameters typed as `unknown` even when the function type has the correct types

Aperta
#57,654 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Needs More Info
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 to unknown
⏯ Playground Link

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

  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 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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.