microsoft / microsoft/TypeScript

Computing constraint of conditional type by replacing contravariant infer variables with their constraints is unsound

オープン
#26,945 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@ahejlsberg がすでに取り組んでいます。

2018年9月7日 から。

Bug Domain: Conditional Types
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

TypeScript Version: master (8f654f0)

Search Terms:
conditional type assignability assignable constraint contravariant infer variable parameter unsound

Code

type Foo<A> = [A] extends [[infer B]] ? (arg: B) => void : never;
function fortyTwo<A>(x: Foo<A>) { x(42); }
fortyTwo<[string]>((arg: string) => console.log(arg.slice()));

Expected behavior: Compile error on x(42).

Actual behavior: Successful compilation and runtime error.

Playground Link: link

Related Issues: #26933

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。