microsoft / microsoft/TypeScript
Higher order type inference doesn't work with overloads
オープン
@ahejlsberg がすでに取り組んでいます。
2019年9月25日 から。
Suggestion
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
@ahejlsberg
TypeScript Version: typescript@3.7.0-dev.20190925
Search Terms:
Code
interface Curried2<a, b, z> {
(a: a, b: b): z;
(a: a): (b: b) => z;
}
interface Curry {
<a, b, z>(f: (a: a, b: b) => z): Curried2<a, b, z>;
}
declare const curry: Curry;
curry(<T extends 0, U extends 1>(n: T, m: U) => n + m)(1)(0);
curry(<T extends 0, U extends 1>(n: T, m: U) => n + m)(1, 0);
Also the following doesn't work:
interface Curried2<a, b, z> {
(a: a): (b: b) => z;
(a: a, b: b): z;
}
When removing overloads as follows:
interface Curried2<a, b, z> {
(a: a, b: b): z;
}
or
interface Curried2<a, b, z> {
(a: a): (b: b) => z;
}
These work correctly.
Expected behavior:
Infer type parameters correctly and all parameter values are rejected correctly.
Actual behavior:
no error.
Playground Link:
Related Issues:
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。