web-std / io

Web standard IO APIs implemented for nodejs
92 stars 31 forks source link

fix: typescript types #56

Closed jacob-ebey closed 2 years ago

jacob-ebey commented 2 years ago

fix(packages/stream): no initializers in ambient contexts fix(packages/fetch): only export what's needed so TS doesn't mess up the imports in the output files

Projects that import from web-std currently get some nasty errors such as:

node_modules/@web-std/stream/src/lib.d.ts:18:5 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

18 } = globalThis
       ~~~~~~~~~~

and

node_modules/@web-std/fetch/dist/src/fetch.d.ts:5:32 - error TS2307: Cannot find module 'packages/stream/src/lib.js' or its corresponding type declarations.

5 import { ReadableStream } from "packages/stream/src/lib.js";
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This PR addresses these issues.

jacob-ebey commented 2 years ago

@Gozala, hoping to get this merged.

jacob-ebey commented 2 years ago

If you are looking for another maintainer I'd be happy happy to help BTW.