Closed bdotsamir closed 2 years ago
This isn't a hard fork of the bot; as commits land in the dev branch i'll merge them into here as well.
So far the bot cannot start because TSc cannot transpile. There are a little over 200 (strict mode) issues that need to be solved first before it'll even think about it.
it keeps saying that the merges are unverified, trust me, they're me.
jack, just so we're on the same page, is this actually something you'd like to do with vector? turn it into a typescript project? i just submitted this PR for funsies, but if you're willing to, i'd love to continue working on this
im not entirely sure yet
the main thing im worried about is dependencies, since most of them use regular js instead of ts
i wanna know, how does ts interact with js? and vice versa
typescript is a superset of javascript. that is to say, any valid js code is valid ts code. the only difference is that ts is type-safe (by opt-in, which i have), and somewhat more object oriented.
the typescript "compiler" just takes any ts code, checks for the rules of ts, and transpiles the code down to javascript, which is then run by nodejs in this case. as far as libraries go, follow the first paragraph. any js code is valid ts code. they'll sometimes include "types," which means either:
a) the lib itself is written in ts, which is fine, because it's ts on ts code. or,
b) there's a special file the devs include (you might see it sometimes, the index.d.ts
file) to define the types of the inputs and outputs of the methods exported by the lib.
if neither of these options are available, there are crowdsourced types available through the DefinitelyTyped repo, which you can install to your dev dependencies through yarn add --dev @types/package
.
And for what it's worth, there are only very rare cases when a package doesn't have types at all. For those, you can manually define them yourself, or submit a pr to the DT repo (like i did here for jaro-winkler). It takes about a week for those PRs to be accepted.
update: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/56607 was merged. types for jaro-winkler are now live 🎉
In case you were still interested in this, there's a video i just saw that sums up TS pretty well. https://youtu.be/EUlM3wx546o
first commit pushed from my ipad hell yeah gamers we code on the roll 😎
iVector
Checking in on this by the way, is this still a project you'd care to see more progress on?
what is pnpm?
Checking in on this by the way, is this still a project you'd care to see more progress on?
(also for future reference: i accidentally answered this over discord before i even saw this comment lmao)
what is pnpm?
pnpm is an alternative to npm that hosts all of your node_modules in a single folder somewhere. Each time a new dependency is added to a project, pnpm checks that folder to see whether or not the module exists, and links to it. If it doesn't exist, it downloads it into the main folder and links to it. This reduces the amount of storage space that gets utilized by every node project you work on.
pnpm is an alternative to npm that hosts all of your node_modules in a single folder somewhere. Each time a new dependency is added to a project, pnpm checks that folder to see whether or not the module exists, and links to it. If it doesn't exist, it downloads it into the main folder and links to it. This reduces the amount of storage space that gets utilized by every node project you work on.
....
Unassigning myself as this is something Jack and I are now working on jointly
since vector is going full-time TS, would it be appropriate (and possible) to merge this now?
not yet. in its current state, the codebase doesn't compile. still working out some kinks. i'll unmark as WIP when i'm finished and we can continue from there.
what seems to be causing it?
not at my pc at the moment. will get back to you later, although you're free to clone my fork and see for yourself in the mean time
currently the API section (namely api.ts) is seemingly unable to be converted to TS due to the fact that the Express
type that gets assigned to the app variable is not publicly accessible. We're now faced with an interesting catch-22 situation; do we complete #9 in order to complete this PR or do we complete this pr in order to complete #9?
We could also create a branch of this branch, work on replacing express, and merge that branch into this PR. That gets a bit into the weeds though, and we have to be super sure we're committing to the right branch.
Convert the bot to typescript. This will be an ongoing project for myself.