Property 'cmds' does not exist on type 'Client<boolean>'

It's my first time using TypeScript with discord.js & express, I used some of my JS knowledge and it is causing an error now. (if it isnt fixable then what would be the best way to approach slash command handlers on TypeScript)
C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
src/client.ts:15:8 - error TS2339: Property 'cmds' does not exist on type 'Client<boolean>'.

15 client.cmds = new Collection();
~~~~

at createTSError (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:859:12)
at reportTSError (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:863:19)
at getOutput (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1077:36)
at Object.compile (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1433:41)
at Module.m._compile (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:827:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29) {
diagnosticCodes: [ 2339 ]
}
C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
src/client.ts:15:8 - error TS2339: Property 'cmds' does not exist on type 'Client<boolean>'.

15 client.cmds = new Collection();
~~~~

at createTSError (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:859:12)
at reportTSError (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:863:19)
at getOutput (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1077:36)
at Object.compile (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1433:41)
at Module.m._compile (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\------\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:827:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29) {
diagnosticCodes: [ 2339 ]
}
npm v.9.6.7 node v.18.3.0 discord.js v14.11.0
7 Replies
d.js toolkit
d.js toolkit16mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
d.js docs
d.js docs16mo ago
TypeScript (TS) is a typed superset of JavaScript that compiles to plain JavaScript - website | GitHub | book
treble/luna
treble/luna16mo ago
wrong one
d.js docs
d.js docs16mo ago
We highly recommend you extend the Client structure properly instead of just attaching custom properties like .commands to the regular discord.js Client instance. - Using typescript, you might want to consider casting or augmenting the module type
Yuuki | ユウキ
You can probably just make your own interface that extends the discord.js Client.
Yuuki | ユウキ
ts
TypeScript Tutorial
TypeScript Extend Interface
in this tutorial, you will learn how to extend an interface that allows you to copy properties and methods of one interface to another.
Yuuki | ユウキ
I can give you the straight up solution as well if you want to. Ohh, someon answered already, my bad ohnocat
Want results from more Discord servers?
Add your server