Skip to content

Add lib types for JSON.rawJSON, JSON.isRawJSON, and reviver context - #7

Open
hbrooks wants to merge 7 commits into
mainfrom
demo/pr-63248
Open

hbrooks wants to merge 7 commits into
mainfrom
demo/pr-63248

Conversation

@hbrooks

@hbrooks hbrooks commented May 28, 2026

Copy link
Copy Markdown

Originally PR microsoft#63248 in microsoft/TypeScript by @VedantMadane

VedantMadane and others added 7 commits March 13, 2026 08:32
Adds esnext.json.d.ts with type definitions for the Stage 4 TC39
proposal-json-parse-with-source (shipped in all major browsers and
Node.js 22+):

- JSON.rawJSON(text): creates a RawJSON object for lossless serialization
- JSON.isRawJSON(value): type guard narrowing to RawJSON
- JSON.parse reviver context: third parameter with { source: string }

Fixes microsoft#61330
The proposal-json-parse-with-source is Stage 4 and part of ES2025,
so the lib should live in es2025.json.d.ts, not esnext.json.d.ts.
RyanCavanaugh noted this PR is still valid minus commandlineParser.ts.
Revert commandLineParser.ts to match upstream main.
- Add test cases for array elements and nested structures.
- Ensure JSDoc aligns with existing patterns.

Signed-off-by: Vedant Madane <vedantnm@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants