microsoft / microsoft/TypeScript

Support `proposal-json-parse-with-source` (`JSON.rawJSON()`, `JSON.isRawJSON()`, `context` parameter of `reviver` function, etc...)

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

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

Bug Domain: lib.d.ts Help Wanted
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

### ⚙ Compilation target

ESNext

### ⚙ Library

ESNext

### Missing / Incorrect Definition

`JSON.rawJSON()` appears to be missing. Apologies if I've missed something or if this is the wrong place to raise an issue. I searched through both PRs and issues in both this repo and https://github.com/microsoft/TypeScript-DOM-lib-generator but couldn't find any references for it.

![Image](https://github.com/user-attachments/assets/004929f6-4833-4818-8541-edb6f94571c5)

### Sample Code

```TypeScript
// https://www.typescriptlang.org/play/?target=99#code/MYewdgzgLgBAHjAvDAUgZQPIDkB0AnAQwHd1sAKAcgAYKBKIA
const x = JSON.rawJSON('0')
```

### Documentation Link

Per https://github.com/microsoft/TypeScript/issues/19044 it seems like TypeScript's policy is to support Stage 3+ features and [proposal-json-parse-with-source](https://github.com/tc39/proposal-json-parse-with-source) is stage 3. (If I misunderstood the typescript teams policy on experimental features it would be awesome to have this documented in https://github.com/Microsoft/TypeScript/wiki/FAQ)

MDN also documents this feature [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/rawJSON).

Additionally, it appears to have been implemented [in V8](https://github.com/v8/v8/commit/e2f909764780a62017788e69f85c89d915185f40) and [in webkit](https://github.com/WebKit/WebKit/pull/7057).

Testing experimentally, it is available in node 22+ and in the latest Chromium as well:

![Image](https://github.com/user-attachments/assets/25f556f0-9741-40e0-912b-854ac067fd8a)

![Image](https://github.com/user-attachments/assets/be88c1f7-3967-4913-af08-06d751c4f8bc)

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

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

はじめの一歩

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

調査の方向性

まず ESNext ライブラリ定義を確認し、その JSON API を proposal-json-parse-with-source 仕様と比較します。issue の TypeScript サンプルを使用して、JSON.rawJSON()、JSON.isRawJSON()、reviver のコンテキストパラメーターなど、欠落している宣言を確認し、続けて ESNext ターゲットがそれらを受け入れることを検証します。

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

評価

技術スタック
javascript, typescript
領域
compilers
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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