Is it reasonable to import TypeScript source from Github instead of compiled NPM library? (Twurple)
This might not be the place, but I'm brain dead and soon going to bed, so here goes.
Today I tried to get Twurple working in Deno as I want a premade library for Twitch, but I can't for the life of me get types working when importing it from NPM, it just doesn't do anything while I got Discord.js to work just fine.
But, the whole project is written in TypeScript on Github, so, would it be a valid path to pursue and include the source of the project directly? I believe I read that Deno can import directly from Github, with that I hope types have a higher chance of working. I might have to try and import the right folder in the repository though, not sure if that kind of granularity is possible.
I'll try this tomorrow, if I have time after social engagements, but if anyone has any prior experience doing anything like this it would be lovely to hear how it went. That's about it! 😅
Happy Friday! 👍
4 Replies
I think it will be a pain to try to import the package you're talking about via Github. I have imported only very simple TS files from Github, via jsdelivr
You can try to import it via esm.sh too, through a link similar to this:
https://esm.sh/twurple@1.0.0/common
It works for me, so probably either you are doing something wrong or Deno has a bug
That is good to hear, I haven't experimented more yet, but will do a fresh project and see if I can tweak settings. With dependencies for Twurple possibly not being .ts it does feel like importing the built libraries would probably make more sense, so if I can do that... huzzah! I hope to get to this in the weekend.
Just for my own sanity, which IDE are you using? I'm on PhpStorm / WebStorm. I'll check which languaeg server I'm using when I can.
Using VSCodium