jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.2k stars 505 forks source link

tsdx build fails while tsc works #1137

Open itaied246 opened 2 years ago

itaied246 commented 2 years ago

Current Behavior

Running yarn tsc works while running yarn build fails with various typescript errors. Here is one for example:

$ yarn build
@rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
@rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
✓ Creating entry file 29 ms
(typescript) Error: /home/me/app/src/components/notification/Notification.tsx(87,34): semantic error TS2590: Expression produces a union type that is too complex to represent.
...

Expected behavior

Work...

Additional context

I tried using --transpileOnly flag, but I get the same error.

Your environment

  System:
    OS: Linux 5.13 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz
    Memory: 23.29 GB / 31.06 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    Yarn: 1.23.0-20220130.1630 - ~/.nvm/versions/node/v16.15.0/bin/yarn
    npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
  Browsers:
    Chrome: 101.0.4951.41
    Firefox: 99.0
  npmPackages:
    tsdx: ^0.14.1 => 0.14.1 
    typescript: ^4.5.5 => 4.6.3 
joernroeder commented 1 year ago

same here. tsc works but tsdx not. --transpileOnly fixed it for me

thijs-qv commented 7 months ago

I also ran into this issue. --transpileOnly fixes it for me as well, but this turns off type checking? I have no type errors when building with tsc, nor in VScode. I'm getting

Object is of type 'unknown'

when importing a zustand store (which is correctly typed). Since it's not clear where exactly the error comes from it is difficult to debug.