microsoft / microsoft/TypeScript
[Post-7.0] Improve readability of `Array.from` / `TypedArray.from` `mapFn` parameters
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.3k
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 132
Descripción
Currently, the mapFn argument of Array.from() is typed as (v: T, k: number) => U.
However, when this information is displayed in an IDE tooltip, it is difficult to grasp what values are passed to v and k.
To improve clarity, I propose changing the type definition to (element: T, index: number) => U, following the description of the same method in MDN Web Docs. The same applies to TypedArray.from().
Supplementary Information:
- The target file is
internal/bundled/libs/lib.es2015.iterable.d.ts#L107. - These changes are not intended to fix differences between 6.0 and 7.0, and according to
CONTRIBUTING.md, the Pull Request should be submitted after the 7.0 release. I plan to submit a Pull Request for this once 7.0 is released.
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 en internal/bundled/libs/lib.es2015.iterable.d.ts#L107 y localiza las declaraciones de mapFn de Array.from y TypedArray.from. Compara los nombres de sus parámetros con la descripción vinculada de MDN y confirma después que ambas declaraciones usan nombres descriptivos para el elemento y el índice sin cambiar sus tipos ni su comportamiento.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- tooling
- Tipo de issue
- Refactorización
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Estado de actividad
- Activo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 88/100