microsoft / microsoft/TypeScript
Invalid type inference when using arrow function but normal functions is ok
Nessuno ha ancora preso questa issue.
- 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.30and@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:
@effect/io <=0.30+ TS 5.1: https://stackblitz.com/edit/typescript-qiykfu (This is what I think is actual behavior)@effect/io ^0.32+ TS 5.1: https://stackblitz.com/edit/typescript-wjbz9s@effect/io ^0.32+ TS 5.2 (dev, next channel): https://stackblitz.com/edit/typescript-tbg3w8
💻 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
- 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 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