Skip to content

Add Node and Deno in criteria to add a feature #1476

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

Open
regseb opened this issue Jan 15, 2023 · 1 comment
Open

Add Node and Deno in criteria to add a feature #1476

regseb opened this issue Jan 15, 2023 · 1 comment

Comments

@regseb
Copy link

regseb commented Jan 15, 2023

The addition of the static Response.json(data, init) method was refused because it isn't implemented by two major vendors. It's implemented in Blink, but not in Gecko and WebKit.

It's already implemented in Node and Deno because it's mostly useful on the backend:

  • Create easily a server response with JSON (cf. Deno v1.22):

    import { serve } from "https://deno.land/[email protected]/http/server.ts";
    await serve(() => Response.json({ foo: "bar" }), { port: 8080 });
  • Mock easily the response of a request:

    sinon.stub(globalThis, "fetch").resolves(Response.json({ foo: "bar" }));

I think Mozilla and Apple are in no rush to implement this method. We may have this lack for a while.


I propose to add Node and Deno in the list of vendors.

Why is my fancy API still not available here?
A feature needs to be supported by two or more major browser engines or JavaScript runtime to be included here, to make sure there is a good consensus among vendors: Gecko (Firefox), Blink (Chrome/Edge), WebKit (Safari), Node and Deno.

If the condition is met but still is not available here, first check the contribution guidelines below and then please file an issue.

@saschanaz
Copy link
Contributor

saschanaz commented Jan 15, 2023

I don't think this is the way to go since it's useless for browser purpose when only Blink/Node/Deno implements things and other browser engines do not.

Instead, I suggested #1402 for non-browser implementations so that we can have a set of lib for browsers and another lib for general JavaScript environments.

(That needs some interest from TypeScript team)

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

2 participants