#Event status types
20 messages · Page 1 of 1 (latest)
I understand this, but my question is where will that generic parameter be filled in?
I thought that by setting the type of the status property it would get it from there wouldn't it?
that's the part I'm not sure about which is why I asked you
Are you saying that specific gateway events would return GuildScheduledEvent<Type>
that could also be a thing but for other events I thought that if the status property is of type Status, then you could use that to determine what types are accepted in the method
I'm gonna ask in TS support
You can, but it needs to be set at some point
Like the generic parameter needs to be a specific event at some point, before runtime
At most you can check if event.status === 'ACTIVE' and then it asserts that its an active event that can be only completed. You can't infer the type at runtime
then we could have this type parameter and use that for our own checks right?
it'd be useless
but sure
realistically you could
but you'd need isX: this is Event<aaa>
do we need typeguards? Can't we just do the strict equality check?
cuz doing typeguards for a property is quite stupid lol
Do be able to use the strict equality you need to define GuildScheduledEvent as an union of the 3 possible states
aight let's scrap that idea then
I mean it's doable! It's how in -types, checking by audit log key name automatically types the old/new values