Collection with TypeScript.

Hello, I'm declaring a collection like in the image below (inside a class constructor), but am getting the following error: Generic type 'Collection<K, V>' requires 2 type argument(s).
16 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Grif
GrifOP3y ago
Oh I see, I would be putting objects into that Collection, so the correct way would be: textCommands: Collection<string, Object>?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Grif
GrifOP3y ago
I do yes, so I could create an interface called Command above it and then pass it in? That's very smart!
Grif
GrifOP3y ago
that works, thanks!
Grif
GrifOP3y ago
I do have another issue tho not realted to collections, do i create a new thing or just rename this one?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Grif
GrifOP3y ago
Oh, why so, what's the difference between the two?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Grif
GrifOP3y ago
oh I see thank you a lot everyone! really great help <3
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Almeida
Almeida3y ago
you can just use slashCommands = new Collection<string, SlashCommandExport>();
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Grif
GrifOP3y ago
Did sort of a version of that. BUT, I did create an interface called SlashCommandExport which is kind of a blueprint for an object so
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Grif
GrifOP3y ago
yeah i corrected it
Want results from more Discord servers?
Add your server