microsoft / microsoft/TypeScript

Invalid type inference when using arrow function but normal functions is ok

Aperta
#55,017 2 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

Bug Report

🔎 Search Terms

Invalid type inference with arrow function

🕗 Version & Regression Information
  • This changed between versions @effect/io^0.30 and @effect/io>=0.31. The main change that I suspect is causing the bug is this commit.
⏯ Playground Link

At least, playground cannot import third-party lib(effect). so here, I provide some stackblitz links:

💻 Code

🙁 Actual behavior

If you write it as a regular function expression, the type is inferred without any problems. but writing in arrow function expressions causes problems with type inference.

🙂 Expected behavior

In the same way that the Effect library works, the resolve function should be correctly typed by inferring the dependencies passed through the effect object, the type of the required objects, and the way the function is written. There should be no difference in the way the resolve function is written.

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 confrontando le tre riproduzioni StackBlitz e ispeziona il commit sospetto di @effect/io collegato nel report, concentrandoti sulla modifica che influisce sull’inferenza. Conferma il comportamento per le forme equivalenti di funzione regolare e funzione freccia; il lavoro è completo quando la forma freccia inferisce resolve dalle dipendenze dell’effetto e dai tipi di oggetto richiesti nello stesso modo.

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
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.