Skip to content
GitHub

MockProps

type alias in meocord/testing Since 4.0.0

type MockProps<T> = {
  -readonly [K in keyof T]?: K extends 'authorizingIntegrationOwners'
    ? T[K] | APIAuthorizingIntegrationOwnersMap
    : T[K] extends (...args: any[]) => any
      ? (...args: any[]) => any
      : T[K]
}

Property values a mock factory sets as it builds the mock.

Use it for anything the discord.js class declares readonly, such as ModalSubmitInteraction#customId, which the returned mock does not let you assign.

Examples

TypeScript
const modal = createMockInteraction(ModalSubmitInteraction, { customId: 'feedback' })

See also