Skip to content

Change fetch.json() type to unknown #2298

Open

Description

Summary

Follow NodeJS type and change to unknown

Expected vs. Actual Behavior

Please align with NodeJS fetch types

unknown is preferred over any and would be more precise because without validating received data one does not really know what has been received

Playground Link

No response

Browser Support

  • This API is supported in at least two major browser engines (not two Chromium-based browsers).

Have Tried The Latest Releases

  • This issue applies to the latest release of TypeScript.
  • This issue applies to the latest release of @types/web.

Additional Context

No response

Activity

  1. HolgerJeromin commented on Dec 19, 2025

    @HolgerJeromin
    Contributor

    This will break very much existing code.
    See microsoft/TypeScript#60899 for more background

  2. saschanaz commented on Dec 20, 2025

    @saschanaz
    Contributor

    Yeah, this would be technically correct but would still be scary in terms of compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions