Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for JSON.rawJSON() #61330

Open
jarpoole opened this issue Mar 2, 2025 · 0 comments
Open

Support for JSON.rawJSON() #61330

jarpoole opened this issue Mar 2, 2025 · 0 comments

Comments

@jarpoole
Copy link

jarpoole commented Mar 2, 2025

⚙ 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

Sample Code

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

Documentation Link

Per #19044 it seems like TypeScript's policy is to support Stage 3+ features and 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.

Additionally, it appears to have been implemented in V8 and in webkit.

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

Image

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant