GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add lib types for JSON.rawJSON, JSON.isRawJSON, and reviver context by VedantMadane · Pull Request #63248 · microsoft/TypeScript

Conversation

@VedantMadane

@VedantMadane Vedant Madane (VedantMadane) commented Mar 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Adds es2025.json.d.ts with type definitions for the Stage 4 TC39 proposal-json-parse-with-source which is part of ES2025 and has shipped in all major browsers and Node.js 22+. ## Summary - JSON.rawJSON(text) - creates a frozen RawJSON object for lossless JSON serialization (e.g. preserving large-integer precision) - JSON.isRawJSON(value) - type-guard that narrows to RawJSON - JSON.parse reviver context - overload whose reviver receives a third parameter { source: string } containing the original JSON source text of each primitive value ### New files | File | Purpose | |---|---| | src/lib/es2025.json.d.ts | RawJSON interface + JSON augmentations | | tests/cases/compiler/jsonParseWithSource.ts | Compiler test exercising all three APIs | | tests/baselines/reference/jsonParseWithSource.* | Accepted baselines | ### Modified files | File | Change | |---|---| | src/lib/es2025.d.ts | /// <reference lib=es2025.json /> | | src/lib/libs.json | Register es2025.json | | src/compiler/commandLineParser.ts | Map es2025.json to its .d.ts | Fixes #61330

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

LeviticusMB, fraukesch, ltyocg, and Digifox03 reacted with heart emoji
All reactions
  • ❤️ 4 reactions
@github-project-automation github-project-automation Bot added this to PR Backlog Mar 13, 2026
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Mar 13, 2026
@Renegade334

René (Renegade334) commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

which is part of ES2025

It isn't, MDN is wrong on this one. It has stage 4 approval, but is not yet in the latest draft: tc39/ecma262#3714

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot TypeScript Bot (typescript-bot) closed this Mar 24, 2026
@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-project-automation github-project-automation Bot moved this from Not started to Done in PR Backlog Mar 24, 2026
@RyanCavanaugh

Ryan Cavanaugh (RyanCavanaugh) commented Mar 24, 2026

Copy link
Copy Markdown
Member

Reopening as this is still valid (minus commandlineParser.ts)

VedantMadane reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh) reopened this Mar 24, 2026
@github-project-automation github-project-automation Bot moved this from Done to Not started in PR Backlog Mar 24, 2026
@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh) added this to the Post-7.0 lib candidates milestone Mar 24, 2026
ArshVermaGit

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot AI review requested due to automatic review settings April 16, 2026 07:39
@typescript-bot TypeScript Bot (typescript-bot) added the For Backlog Bug PRs that fix a backlog bug label Apr 16, 2026
Copilot started reviewing on behalf of Vedant Madane (VedantMadane) April 16, 2026 07:40
View session
Copilot AI reviewed Apr 16, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an ES2025-by-feature lib file to type the now-standard JSON.rawJSON, JSON.isRawJSON, and the JSON.parse reviver “source context” capability, and wires it into the es2025 lib plus compiler test coverage.

Changes:

  • Introduces src/lib/es2025.json.d.ts defining RawJSON and augmenting JSON with rawJSON, isRawJSON, and a JSON.parse overload with a context parameter.
  • References the new lib from src/lib/es2025.d.ts and registers es2025.json in src/lib/libs.json.
  • Adds a compiler test (jsonParseWithSource.ts) and accepted baselines covering all three APIs.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/lib/es2025.json.d.ts Adds RawJSON and JSON API typings for the ES2025 JSON additions.
src/lib/es2025.d.ts Includes the new es2025.json lib in the es2025 umbrella lib.
src/lib/libs.json Registers es2025.json as an available by-feature lib.
tests/cases/compiler/jsonParseWithSource.ts Compiler test exercising rawJSON, isRawJSON, and reviver context.
tests/baselines/reference/jsonParseWithSource.types Baseline for type printing of the new APIs.
tests/baselines/reference/jsonParseWithSource.symbols Baseline for symbol resolution including the new lib.
tests/baselines/reference/jsonParseWithSource.js Baseline for JS emit.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
afurm
Andrii Furmanets (afurm) reviewed Apr 17, 2026
View reviewed changes

@afurm Andrii Furmanets (afurm) left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach / Design (nits):

  1. JSON.rawJSON(text: string): RawJSON — The JSDoc documents the happy path but doesn't mention @throws for invalid input. Per the spec, JSON.rawJSON throws a SyntaxError when text is not a valid JSON primitive (not a string, number, boolean, or null) or is an object/array. Adding @throws {SyntaxError} would align with the existing JSON.parse JSDoc and help consumers handle error cases.

  2. Test coverage for reviver context — The test file has one reviver test using a plain object. It might be worth adding cases for:

    • Array elements ("arr": [1, 2, 3]) — the context source for each element
    • Nested objects to verify the context is available at all levels

These are minor suggestions; the type definitions themselves look correct and match the Stage 4 proposal. The infrastructure changes (libs.json, commandLineParser.ts, es2025.d.ts) all look routine and correct.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@RyanCavanaugh

Ryan Cavanaugh (RyanCavanaugh) commented Apr 17, 2026

Copy link
Copy Markdown
Member

Andrii Furmanets (@afurm) future automated comments will result in a block; any automated activity we want to occur in this repo we will set up ourselves or already have

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MulverineX

Mulverine (MulverineX) commented Apr 29, 2026

Copy link
Copy Markdown

Ryan Cavanaugh (@RyanCavanaugh) the commandLineParser.ts has since been removed, is there a reason this PR is not proceeding?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hbrooks Hunter Brooks (hbrooks) mentioned this pull request May 28, 2026
Add lib types for JSON.rawJSON, JSON.isRawJSON, and reviver context ellipsis-dev-test/TypeScript#7
Open
aweebit
aweebit reviewed Aug 7, 2026
View reviewed changes
Comment thread src/lib/es2025.json.d.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Vedant Madane (VedantMadane) added a commit to VedantMadane/TypeScript that referenced this pull request Aug 8, 2026
@VedantMadane
fix(lib): make JSON.parse reviver context.source optional
078f805
Per the ECMAScript spec, context.source is only present when the property is unmodified and its value is primitive. Update the es2025.json typings and compiler tests/baselines accordingly.

Also re-add es2025.json to libMap so /// <reference lib="es2025.json" /> resolves (required for the es2025 umbrella lib to include the definitions).

Addresses review feedback on microsoft#63248.
@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh) added the Voight-Kampff Anomaly Repeated exogenous PRs look increasingly conceivable as non-human tinkering label Aug 10, 2026
@VedantMadane
Vedant Madane (VedantMadane) force-pushed the feat/json-parse-with-source branch 2 times, most recently from 34237c8 to 38e8ed5 Compare August 24, 2026 10:14
@MulverineX

Mulverine (MulverineX) commented Aug 24, 2026

Copy link
Copy Markdown

Even if this is a bot this is still something that needs to get implemented, its pretty annoying to have to vendor these types in

aweebit reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot mentioned this pull request Aug 26, 2026
fix(tier 0–1): a bound whose own NaN makes its guard read false developerz-ai/ultimate#364
Merged
@VedantMadane
Vedant Madane (VedantMadane) force-pushed the feat/json-parse-with-source branch from 38e8ed5 to 54dd28d Compare September 9, 2026 13:39
@VedantMadane
Vedant Madane (VedantMadane) force-pushed the feat/json-parse-with-source branch from 54dd28d to c842877 Compare September 17, 2026 07:19
@VedantMadane Vedant Madane (VedantMadane) closed this Oct 1, 2026
@VedantMadane
Vedant Madane (VedantMadane) force-pushed the feat/json-parse-with-source branch from c842877 to edf7da4 Compare October 1, 2026 08:23
@VedantMadane
Add lib types for JSON.rawJSON, JSON.isRawJSON, and reviver context
3e03cf2
Port proposal-json-parse-with-source (ES2025) lib typings onto the Go
tree layout:

- tsc/internal/bundled/source/es2025.json.d.ts (+ generated lib/embed)
- reference from es2025 umbrella + libs.json + LibMap (enummaps.go)
- compiler test and baselines

Preserves RawJSON, JSON.rawJSON, JSON.isRawJSON, and optional
context.source on JSON.parse reviver.

Fixes microsoft#61330

Signed-off-by: Vedant Madane <[email protected]>
@VedantMadane Vedant Madane (VedantMadane) reopened this Oct 1, 2026
@VedantMadane

Vedant Madane (VedantMadane) commented Oct 1, 2026

Copy link
Copy Markdown
Author

Rebased onto current main and resolved merge conflicts.

New head: 3e03cf29a24aaa117f029296c9f7786c7eb81146

Conflict resolution

File Resolution
tsc/internal/tsoptions/enummaps.go Kept main's es2026.* lib map entries and re-added es2025.json
.../Parse invalid option of library flags.js Took main's error text (includes es2026 libs) and inserted 'es2025.json' after 'es2025.regexp'

Regenerated

  • Ran go run generate.go in tsc/internal/bundled so embed_generated.go / libs_generated.go match the libs directory (only dropped a trailing blank line vs the cherry-pick auto-merge).

Feature kept

  • lib.es2025.json.d.ts with RawJSON, JSON.rawJSON, JSON.isRawJSON, and JSON.parse reviver context.source?
  • Reference from lib.es2025.d.ts, LibMap entry, compiler test + baselines

Note / remaining risk

main already ships the same APIs under lib.es2026.json.d.ts (via #64096), with a branded RawJSONInstance design and conformance tests under es2026/. This PR still places typings on es2025.json as originally proposed. Loading both (e.g. es2026 → references es2025) will merge the JSON/RawJSON declarations; worth a maintainer call on whether es2025.json is still desired given earlier feedback that the proposal is not in the ES2025 draft, and the existing es2026.json coverage.

Baselines for the new compiler test were carried from the prior PR tip (not re-run locally on Windows). CI should confirm.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@VedantMadane

Vedant Madane (VedantMadane) commented Oct 3, 2026

Copy link
Copy Markdown
Author

Closing this PR as the feature has already landed upstream under lib.es2026.json.d.ts via #64096. Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@VedantMadane Vedant Madane (VedantMadane) closed this Oct 3, 2026
@github-project-automation github-project-automation Bot moved this from Not started to Done in PR Backlog Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
+3 more reviewers
@afurm Andrii Furmanets (afurm) afurm left review comments
@aweebit aweebit aweebit left review comments
@ArshVermaGit Arsh Verma (ArshVermaGit) ArshVermaGit left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

For Backlog Bug PRs that fix a backlog bug Voight-Kampff Anomaly Repeated exogenous PRs look increasingly conceivable as non-human tinkering

Projects

PR Backlog
Status: Done

Milestone

Post-7.0 lib candidates

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

9 participants

@VedantMadane @Renegade334 @typescript-bot @RyanCavanaugh @MulverineX @afurm @aweebit @ArshVermaGit
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.