Skip to content
GitHub

ParamRefsOf

type alias in meocord/interface Since 4.1.0

type ParamRefsOf<P extends string> = {
  [
    S in PatternSpecs<P> as S['optional'] extends true ? never : S['name']
  ]: S['guard']
} & {
  [
    S in PatternSpecs<P> as S['optional'] extends true ? S['name'] : never
  ]?: S['guard']
}

The params of a message pattern as its guards see them: each member, user, role and channel as an EntityRef.

Use it to type a guard's params for a message command: ParamRefsOf<'ban {target:member}'> is { target: EntityRef<GuildMember> }. Scalars and choices are their values, as in ParamsOf.

See also