Skip to content

ResponseConstructor #1518

Open
Open
@mfulton26

Description

@mfulton26

I would like to globally augment the ResponseConstructor (e.g. add the missing json(data, init) static method, safely add my own using unique symbols, etc.).

However I do not see how to do that as var Response isn't defined with a named type.

declare var Response: {
prototype: Response;
new(body?: BodyInit | null, init?: ResponseInit): Response;
error(): Response;
redirect(url: string | URL, status?: number): Response;
};

I suggest extracting the type to an interface, e.g. named ResponseConstructor to enable global augmentation of these types.

There are likely other types/constructors that could also be given named types too (e.g. AbortController, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions