refactor: use better types for rollMode

This commit is contained in:
Johannes Loher 2022-02-15 21:57:21 +01:00
parent fc3457545c
commit 73e2d44c55

View file

@ -12,8 +12,7 @@ class DefaultCheckOptions implements DS4CheckFactoryOptions {
readonly maximumCoupResult = 1;
readonly minimumFumbleResult = 20;
readonly useSlayingDice = false;
// TODO: Use the type `keyof CONFIG.Dice.rollModes` instead as soon as https://github.com/League-of-Foundry-Developers/foundry-vtt-types/issues/1501 has been resolved.
readonly rollMode: foundry.CONST.DICE_ROLL_MODES = "publicroll";
readonly rollMode: keyof CONFIG.Dice.RollModes = "publicroll";
readonly flavor: undefined;
mergeWith(other: Partial<DS4CheckFactoryOptions>): DS4CheckFactoryOptions {
@ -198,7 +197,7 @@ function parseDialogFormData(formData: HTMLFormElement): Partial<IntermediateGmM
*/
interface GmModifierData {
gmModifier: number;
rollMode: foundry.CONST.DICE_ROLL_MODES;
rollMode: keyof CONFIG.Dice.RollModes;
}
/**
@ -229,7 +228,7 @@ export interface DS4CheckFactoryOptions {
maximumCoupResult: number;
minimumFumbleResult: number;
useSlayingDice: boolean;
rollMode: foundry.CONST.DICE_ROLL_MODES;
rollMode: keyof CONFIG.Dice.RollModes;
flavor?: string;
flavorData?: Record<string, string | number | null>;
speaker?: ReturnType<typeof ChatMessage.getSpeaker>;