custom filter of Channels with their according Type
Hey so i would like a function similar to this:
that should return
PrivateThreadChannel| PublicThreadChannel
But it doesnt seem to work at all, i also tried with single types and its only working for single objs17 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
djs 14.7.1
node v18.3.0
i really need test environment
should i create a sandbox ?
I have an idea
@_kkumar use generics
use what
i tried... but its doesnt really solve any problem
at least from what i thought...
so how would you get the correct typeguard from the ChannelType enum ?
i do understand but it wouldnt work for a dynamic channeltype and is the same as casting it pretty muhc
that actually should give an error, but it doesnt 🤔 same as type casting,
yeah i know, so it really isnt a solution to my problem 🔝
mhm i dont understand how to use a generic here, you have an example
passing the channeltype as generic ? ChannelType is an enum tho...
i dont provide a type, i provide the ChannelType enum
i cant understand, i m sorry. Can you use the variable name ?
I use an array of enums through which the channel array should return the according type
It does if you do it for a single object, in my example you can call single.ownerId
if you do the same with the array it still returns GuildBasedChannel instead of PublicThreadChannel
--
Furthermore i want to provide an array of enums so the enums are dynamic => i cant cast them...
can you write me an example?
...
i am probably far off from what you want to explain me, sorry!
imo best way even if overwriting
well yes but
ah that too yeah
you cant really do it so it gives type you want to put in
hm wait
so basically
this was fun
wow guys, i am very thankful ! Great great work, pretty advanced (at least for me ❤️ )