Enable no unused vars and add more types

This commit is contained in:
Carlos Fernandez 2026-06-14 15:12:47 -04:00
parent af49c1f4c8
commit ba11651b0c
20 changed files with 141 additions and 31 deletions

40
daggerheart.d.ts vendored
View file

@ -2,6 +2,7 @@ import '@client/global.mjs';
import '@common/global.mjs';
import '@common/primitives/global.mjs';
import Canvas from '@client/canvas/board.mjs';
import { ResourceUpdateMap } from './module/data/action/baseAction.mjs';
// Foundry's use of `Object.assign(globalThis) means many globally available objects are not read as such
// This declare global hopefully fixes that
@ -39,4 +40,43 @@ declare global {
const Collection: foundry.utils.Collection;
const FormDataExtended: foundry.applications.ux.FormDataExtended;
const TextEditor: foundry.applications.ux.TextEditor;
/**
* Data used to build rolls such as duality rolls. The definition is incomplete and likely incorrect.
* Objects will often accept a Partial<RollConfig> and spit out a non-partial. Those that are not guaranteed should be marked optional.
*/
interface RollConfig {
// unverified, check which ones are used and optional/not optional
event: Event;
title: string;
roll: {
modifier: number;
simple: boolean;
type: string;
difficulty: number;
};
hasDamage: boolean;
hasEffect: boolean;
hasRoll: boolean;
chatMessage: {
template: string;
mute: boolean;
};
targets: object;
costs: object;
// verified
source?: {
/** uuid of the actor this roll is coming from */
actor: string;
};
/** Roll data associated with the actor or item */
data: object;
resourceUpdates: ResourceUpdateMap;
hooks: string[];
dialog: {
configure: boolean;
};
damageOptions: object;
}
}