microsoft / microsoft/TypeScript
Function parameter names are incorrectly inferred from variadiac tuples
Abierto
@ahejlsberg ya está trabajando en esto.
Desde el 9/9/2020.
Needs Investigation
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
TypeScript Version: 4.1.0-insiders.20200909
Search Terms:
typescript variadic tuple names curry argument
Code
type Curry<A extends unknown[], R> = A extends [infer Head, ...infer Tail] ? (...args: [Head]) => Curry<Tail, R> : R;
declare const curry: <Args extends unknown[], R>(fn: (...args: Args) => R) => Curry<Args, R>;
declare const f: (x: number, y: string, z: boolean) => string;
const g = curry(f); // incorrectly inferred as (arg_0: number) => (arg_0: string) => (arg_0: boolean) => string;
Expected behavior:
The inferred type should have the correct argument names from f, like (x: number) => (y: string) => (z: boolean) => string;
Actual behavior:
(arg_0: number) => (arg_0: string) => (arg_0: boolean) => string;
Playground Link:
https://tsplay.dev/nWPZJN
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.
Evaluación
Este issue todavía no se ha evaluado.