microsoft / microsoft/TypeScript
Invalid type inference when using arrow function but normal functions is ok
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza comparando las tres reproducciones de StackBlitz e inspecciona el commit sospechoso de @effect/io enlazado en el informe, centrándote en el cambio que afecta a la inferencia. Confirma el comportamiento para las formas equivalentes de función regular y función flecha; se considera terminado cuando la forma de flecha infiere resolve a partir de las dependencias del efecto y de los tipos de objeto requeridos de la misma manera.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- compilers
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 35/100