How to consume SolidJS in a TS 4 project?
SolidJS is compiled with TS ~5.7.2. I have a project using TS 4.5.5 and am running into issues compiling:
Line 108 of signal.d.ts is using the
in out
keyword which TS 4 does not support:
8 Replies
maybe
skipLibCheck: true
in tsconfig?Looks like I already had it enabled
Thanks for the suggestion, @bigmistqke
you are welcome 1604! still causing issues?
Yes, indeed. My main issue is we have this build system
- Node 12.7
- Webpack 4
- TS 4.5.5
and we are trying to use SolidJS 1.9.3.
If we update TS, we need to update Node, and if we update Node, we need to update to Webpack 5. So 'm looking for a way to use SolidJS without such a big build system upgrade
🤔 mm interesting. According to chatgpt it's because it fails with the parsing of the .d.ts file.
Are you running node 12.7 on the server or only building on the client? EOL of node 12.7 was in 2022, could be dangerous if u still run it on the server, regarding security and the like.
If you are only running it client side: I would patch the
in out
out of the declaration. in out
has to do with variance, so types might behave slightly different.
If you are also running it on the server: maybe worth it to upgrade node and upgrade the other ones too in the process.Thanks, @bigmistqke. Just using Node.js for client-side / internal tooling to build SPAs.
This is very helpful. I wrote my own TS 5 to TS 4 "downleveler" script since the OSS ones on npm seem to be broken and that allowed me to compile so far, but
babel-solid-plugin
breaks because it uses Node.js features newer than 12.7. I also patched that, but then solid-js
imports seroval-plugins
inline which had some incompatible TS 5 / Node.js code (can't remember which). I was not able to "mock" that module in my webpack config, so I ran into a dead end. It also seemed like too many Band-aids were reuqired to make my build system work, and it doesn't seem sustainaible long-term.
TLDR: It seems possible to continue to "monkey patch" or hack the incompatible modules to work with my build system, but it seems equal work to upgrade my build system to newer Node / TS / Webpack.lol 🤣 sounds painful
how is solid with webpack? i have only used w vite
Haven't tried yet