cordis-lib / cordis

Modular, micro-service based Discord API wrapper written in TS.
https://cordis.js.org
Other
29 stars 1 forks source link

shardCount addition fails when shardCount is set to "auto" #25

Closed zaida04 closed 3 years ago

zaida04 commented 3 years ago

Code

https://github.com/cordis-lib/cordis/blob/6153918a5c3a14bac0108e23411a362b0e937d6d/libs/gateway/src/websocket/Cluster.ts#L252-L254

Issue

This line prompts the eslint error of Operands of '+' operation must either be both strings or both numbers cause of this.startingShard + this.shardCount; This is because even though there is a check earlier for if shardCount is auto and reassigns it to reccomendedShards, the "auto" value still falls through. This can be fixed with a type assertion guaranteeing this.shardCount is a number.

Solution

this.startingShard + this.shardCount; => this.startingShard + (this.shardCount as number)

will create PR shortly

didinele commented 3 years ago

Uh, that's a bit odd, we aren't running into this in CI, are you sure it's not a local issue? i.e have you have ran pnpm i in the root and also compiled the whole codebase? pnpm run build (in the root)

Also, please try the CLI pnpm run lint - could be the VSCode extension too at fault.

zaida04 commented 3 years ago

As weird as it is, I did that and the vsc extension seems to be the only thing setting that off. Must be something with my config in that case.