Skip to content

Blob type is incompatible with node definition of Blob #53668

@jeswr

Description

@jeswr

lib Update Request

Configuration Check

My config is the default config created by running npm init -y && npx tsc --init. No packages have been installed.

Node Version: v19.3.0
NPM Version: 9.6.2

Missing / Incorrect Definition

The Blob type defined here https://github.com/microsoft/TypeScript/blob/e83d61398ea0e4231e882121dd6c6bcfe4fdc9e4/src/lib/dom.generated.d.ts#L3075 is not assignable to the Blob type in node here https://github.com/DefinitelyTyped/DefinitelyTyped/blob/ec8923e261d3619aef6a4663d50159e7e0dcf3e9/types/node/buffer.d.ts#L121 due to type applied to the prototype.

Sample Code

import { Blob as BufferBlob } from "buffer";
const bl: Blob = new BufferBlob([]);

Causes the typescript compilation error

Property 'prototype' is missing in type 'import("buffer").Blob' but required in type 'Blob'.ts(2741)
lib.dom.d.ts(2591, 5): 'prototype' is declared here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalRelates to another program, environment, or user action which we cannot control.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions