microsoft / microsoft/TypeScript

String.split() method's separator argument should allow undefined

オープン 初心者向け
#63,456 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
Awaiting More Feedback Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

### ⚙ Compilation target

ES2024

### ⚙ Library

6.0.2

### Missing / Incorrect Definition

String.split should allow undefined as its separator argument, resulting in an array containing the entire string.

Unlike the case of omitting the separator (#38331), this is a useful feature, since separator may be a variable, and it can be desirable to get an array with the entire string in the case that separator is not set, in order to not need a different code path for this case.

This feature is explicitly defined in the spec. It is not something that just 'happens to work', like using null or a number.

### Sample Code

```TypeScript
console.log("string,that could/split:but-should;not".split(undefined));
```

### Documentation Link

https://tc39.es/ecma262/multipage/text-processing.html#sec-string.prototype.split

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

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

調査の方向性

リンク先のECMAScript仕様に照らしてString.splitの宣言を確認し、separator引数と提示されたサンプルに焦点を当てます。TypeScript定義がundefinedを受け入れ、別のコードパスを必要とせずにサンプルの型チェックが通れば完了です。

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

評価

技術スタック
javascript, typescript
領域
tooling
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
68/100

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

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