microsoft / microsoft/TypeScript

Compiler Errors TS1110 and TS2345 with integer type pattern

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

まだ誰も着手していません。

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

説明

TypeScript Version: 3.0.3

Explicitly marked positive integers are not recognized in a type pattern:

    foo(direction: -1 | 1 | -2 | +2) { }

image

Likewise, calling it using a perfectly legit integer fails with TS2345:

image

Expected behavior:

As everywhere else, the unary operator + should be allowed in a type pattern.
This is not urgent, just for completeness.

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

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

はじめの一歩

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

調査の方向性

ソースファイルもテストも指定されていません。TypeScript 3.0.3 で例を再現し、型パターン -1 | 1 | -2 | +2 と整数値を使用する呼び出しの両方を確認します。型パターンで単項 + が受け入れられ、対応する TS1110 および TS2345 エラーが発生しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

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

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