Update types

This commit is contained in:
Johannes Loher 2021-02-08 02:07:25 +01:00
parent ff3c09f009
commit 746d4d7a44
3 changed files with 8 additions and 8 deletions

2
package-lock.json generated
View file

@ -3119,7 +3119,7 @@
} }
}, },
"foundry-vtt-types": { "foundry-vtt-types": {
"version": "github:League-of-Foundry-Developers/foundry-vtt-types#32d849fd2afa4e88319c0105c989cec62bb888c2", "version": "github:League-of-Foundry-Developers/foundry-vtt-types#f1c321dcfe460595123765ababe5b8772d5df966",
"from": "github:League-of-Foundry-Developers/foundry-vtt-types#foundry-0.7.9", "from": "github:League-of-Foundry-Developers/foundry-vtt-types#foundry-0.7.9",
"dev": true, "dev": true,
"requires": { "requires": {

View file

@ -6,7 +6,7 @@ import { DS4Actor } from "../actor";
/** /**
* The base Sheet class for all DS4 Actors * The base Sheet class for all DS4 Actors
*/ */
export class DS4ActorSheet extends ActorSheet<DS4Actor> { export class DS4ActorSheet extends ActorSheet<ActorSheet.Data<DS4Actor>> {
// TODO(types): Improve mergeObject in upstream so that it isn't necessary to provide all parameters (see https://github.com/League-of-Foundry-Developers/foundry-vtt-types/issues/272) // TODO(types): Improve mergeObject in upstream so that it isn't necessary to provide all parameters (see https://github.com/League-of-Foundry-Developers/foundry-vtt-types/issues/272)
/** @override */ /** @override */
static get defaultOptions(): BaseEntitySheet.Options { static get defaultOptions(): BaseEntitySheet.Options {
@ -48,9 +48,9 @@ export class DS4ActorSheet extends ActorSheet<DS4Actor> {
* object itemsByType. * object itemsByType.
* @returns The data fed to the template of the actor sheet * @returns The data fed to the template of the actor sheet
*/ */
getData(): ActorSheet.Data<DS4Actor> | Promise<ActorSheet.Data<DS4Actor>> { async getData(): Promise<ActorSheet.Data<DS4Actor>> {
const data = { const data = {
...super.getData(), ...(await super.getData()),
// Add the localization config to the data: // Add the localization config to the data:
config: DS4, config: DS4,
// Add the items explicitly sorted by type to the data: // Add the items explicitly sorted by type to the data:
@ -73,7 +73,7 @@ export class DS4ActorSheet extends ActorSheet<DS4Actor> {
html.find(".item-edit").on("click", (ev) => { html.find(".item-edit").on("click", (ev) => {
const li = $(ev.currentTarget).parents(".item"); const li = $(ev.currentTarget).parents(".item");
const item = this.actor.getOwnedItem(li.data("itemId")); const item = this.actor.getOwnedItem(li.data("itemId"));
item.sheet.render(true); item.sheet?.render(true);
}); });
// Delete Inventory Item // Delete Inventory Item

View file

@ -5,7 +5,7 @@ import { isDS4ItemDataTypePhysical } from "./item-data";
/** /**
* The Sheet class for DS4 Items * The Sheet class for DS4 Items
*/ */
export class DS4ItemSheet extends ItemSheet<DS4Item> { export class DS4ItemSheet extends ItemSheet<ItemSheet.Data<DS4Item>> {
/** @override */ /** @override */
static get defaultOptions(): BaseEntitySheet.Options { static get defaultOptions(): BaseEntitySheet.Options {
const superDefaultOptions = super.defaultOptions; const superDefaultOptions = super.defaultOptions;
@ -41,9 +41,9 @@ export class DS4ItemSheet extends ItemSheet<DS4Item> {
} }
/** @override */ /** @override */
getData(): ItemSheet.Data<DS4Item> | Promise<ItemSheet.Data<DS4Item>> { async getData(): Promise<ItemSheet.Data<DS4Item>> {
const data = { const data = {
...super.getData(), ...(await super.getData()),
config: DS4, config: DS4,
isOwned: this.item.isOwned, isOwned: this.item.isOwned,
actor: this.item.actor, actor: this.item.actor,