microsoft / microsoft/TypeScript
Function parameter names are incorrectly inferred from variadiac tuples
オープン
@ahejlsberg がすでに取り組んでいます。
2020年9月9日 から。
Needs Investigation
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。