unjs / unenv

🕊️ Convert javaScript code to be runtime agnostic
MIT License
383 stars 20 forks source link

node `URL.createObjectURL` blob compatibility #65

Open pi0 opened 1 year ago

pi0 commented 1 year ago

URL from node:url is incompatible with web URL

Conversion of type '{ new (url: string | URL, base?: string | URL | undefined): URL; prototype: URL; createObjectURL(obj: Blob | MediaSource): string; revokeObjectURL(url: string): void; }' to type 'typeof URL' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Types of property 'createObjectURL' are incompatible.
    Type '(obj: Blob | MediaSource) => string' is not comparable to type '(blob: Blob) => string'.
      Types of parameters 'obj' and 'blob' are incompatible.
        Type 'Blob' is not comparable to type 'Blob | MediaSource'.
          Property 'prototype' is missing in type 'import("buffer").Blob' but required in type 'Blob'.ts(2352)

Related https://github.com/unjs/unenv/issues/64