improve effects type checking

This commit is contained in:
Johannes Loher 2020-12-29 00:33:43 +01:00
parent aa0c4741d2
commit 082cd03b71
6 changed files with 13 additions and 8 deletions

View file

@ -9,7 +9,7 @@ interface DS4ActorDataAttributes {
mind: ExtensibleData<number>;
}
interface ExtensibleData<T extends any> {
interface ExtensibleData<T> {
initial: T;
}

View file

@ -1,3 +1,4 @@
import { DS4ItemDataType } from "../item/item-data";
import { DS4Actor } from "./actor";
import { DS4ActorDataType } from "./actor-data";
@ -5,7 +6,7 @@ import { DS4ActorDataType } from "./actor-data";
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
export class DS4ActorSheet extends ActorSheet<DS4ActorDataType, DS4Actor> {
export class DS4ActorSheet extends ActorSheet<DS4ActorDataType, DS4Actor, DS4ItemDataType> {
/** @override */
static get defaultOptions(): FormApplicationOptions {
return mergeObject(super.defaultOptions, {
@ -70,7 +71,7 @@ export class DS4ActorSheet extends ActorSheet<DS4ActorDataType, DS4Actor> {
data: data,
};
// Remove the type from the dataset since it's in the itemData.type prop.
delete itemData.data["type"];
delete itemData.data.type;
// Finally, create the item!
return this.actor.createOwnedItem(itemData);

View file

@ -1,10 +1,12 @@
import { DS4Item } from "../item/item";
import { DS4ItemDataType } from "../item/item-data";
import { DS4ActorDataType } from "./actor-data";
/**
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
* @extends {Actor}
*/
export class DS4Actor extends Actor<DS4ActorDataType> {
export class DS4Actor extends Actor<DS4ActorDataType, DS4ItemDataType, DS4Item> {
/** @override */
prepareDerivedData(): void {
const data = this.data;