Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsc fails when used in an app that has tsconfig set to use the DOM lib on bun-types >= 1.0.19 #79

Open
arvilmena opened this issue Dec 27, 2023 · 1 comment

Comments

@arvilmena
Copy link

Hello!

Part of my CI is to run tsc/bunx --bun tsc --noemit for static analysis test.
This test started to trip once we started using elysia-html

bunx --bun tsc --noemit
../../node_modules/@elysiajs/html/src/handler.ts:42:4 - error TS2345: Argument of type 'TransformStream<any, any>' is not assignable to parameter of type 'ReadableWritablePair<any, any>'.
  Types of property 'readable' are incompatible.
    Type 'ReadableStream<any>' is missing the following properties from type 'ReadableStream<any>': values, [Symbol.asyncIterator]

 42    new TransformStream({
       ~~~~~~~~~~~~~~~~~~~~~
 43     transform(chunk, controller) {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
 57     }
    ~~~~~
 58    })
    ~~~~~

../../node_modules/@elysiajs/html/src/handler.ts:63:3 - error TS2345: Argument of type 'ReadableStream<any>' is not assignable to parameter of type 'BodyInit | null | undefined'.
  Property 'prototype' is missing in type 'import("stream/web").ReadableStream<any>' but required in type 'ReadableStream<any>'.

63   stream,
     ~~~~~~

  ../../node_modules/typescript/lib/lib.dom.d.ts:18507:5
    18507     prototype: ReadableStream;
              ~~~~~~~~~
    'prototype' is declared here.


Found 2 errors in the same file, starting at: ../../node_modules/@elysiajs/html/src/handler.ts:42

The reason is that the TransformStream being used for the test is the one from DOM and not from the NodeJS/Bun Types

@arvilmena
Copy link
Author

arvilmena commented Dec 27, 2023

UPDATE: updated title to add "on bun-types >= 1.0.19"
upon further inspection

  1. the issue arises once you started using bun-types version 1.0.19 (the latest as of writing is 1.0.20)
  2. we have an automated check to see if later versions of bun-types work via dependabot, but it's not properly installing the latest bun-types package, hence the test is not accurately testing what it is intended to do
    i.e.: https://github.com/elysiajs/elysia-html/actions/runs/7320895423/job/19940603118?pr=78
    still uses 1.0.18:
image

@arvilmena arvilmena changed the title tsc fails when used in an app that has tsconfig set to use the DOM lib tsc fails when used in an app that has tsconfig set to use the DOM lib on bun-types >= 1.0.19 Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant