Typeseedcordv0.15.0Internal
AssertContextMenuRoute
On a kind mismatch between the decorator and the handler generic, resolves to a non-constructor type so applying the decorator is a TS1238. Cross-checks both directions, mirroring AssertSlashRouteAssertSlashRoute.
type AssertContextMenuRoute<
Kind extends ApplicationCommandType.User | ApplicationCommandType.Message,
TCtor extends new (
...args: any[]
) => InteractionHandler<Repliables>
> = [Kind] extends [ContextMenuKindOf<TCtor>]
? [ContextMenuKindOf<TCtor>] extends [Kind]
? TCtor
: Constructor<
[
"ContextMenuHandler declares a kind the ContextMenuRoute decorator does not match",
ContextMenuKindOf<TCtor>
]
>
: Constructor<
[
"ContextMenuRoute does not match the ContextMenuHandler generic",
Kind
]
>;type AssertContextMenuRoute<
Kind extends ApplicationCommandType.User | ApplicationCommandType.Message,
TCtor extends new (
...args: any[]
) => InteractionHandler<Repliables>
> = [Kind] extends [ContextMenuKindOf<TCtor>]
? [ContextMenuKindOf<TCtor>] extends [Kind]
? TCtor
: Constructor<
[
"ContextMenuHandler declares a kind the ContextMenuRoute decorator does not match",
ContextMenuKindOf<TCtor>
]
>
: Constructor<
[
"ContextMenuRoute does not match the ContextMenuHandler generic",
Kind
]
>;Kind
Kind extends ApplicationCommandType.User | ApplicationCommandType.MessageKind extends ApplicationCommandType.User | ApplicationCommandType.MessageTCtor
TCtor extends new (...args: any[]) => InteractionHandler<Repliables>TCtor extends new (...args: any[]) => InteractionHandler<Repliables>