#Event status types

20 messages · Page 1 of 1 (latest)

weak marsh

I understand this, but my question is where will that generic parameter be filled in?

jagged gale

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

weak marsh
jagged gale

I'm gonna ask in TS support

weak marsh

Like the generic parameter needs to be a specific event at some point, before runtime

vagrant badge

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

jagged gale
vagrant badge

it'd be useless

but sure

realistically you could

but you'd need isX: this is Event<aaa>

jagged gale

do we need typeguards? Can't we just do the strict equality check?

cuz doing typeguards for a property is quite stupid lol

vagrant badge

Do be able to use the strict equality you need to define GuildScheduledEvent as an union of the 3 possible states

jagged gale

aight let's scrap that idea then

vagrant badge

I mean it's doable! It's how in -types, checking by audit log key name automatically types the old/new values