chore: fix issues due to updated types

This commit is contained in:
Johannes Loher 2021-10-10 12:13:27 +02:00
parent 88c6e3f6da
commit c40574f0f5

View file

@ -46,9 +46,7 @@ export async function migrateActors(getActorUpdateData: ActorUpdateDataGetter):
}
}
type SceneUpdateDataGetter = (
sceneData: foundry.documents.BaseScene["data"],
) => DeepPartial<foundry.documents.BaseScene["data"]["_source"]>;
type SceneUpdateDataGetter = (sceneData: foundry.data.SceneData) => DeepPartial<foundry.data.SceneData["_source"]>;
export async function migrateScenes(getSceneUpdateData: SceneUpdateDataGetter): Promise<void> {
for (const scene of getGame().scenes ?? []) {
@ -98,7 +96,7 @@ export function getActorUpdateDataGetter(getItemUpdateData: ItemUpdateDataGetter
}
export function getSceneUpdateDataGetter(getActorUpdateData: ActorUpdateDataGetter): SceneUpdateDataGetter {
return (sceneData: foundry.documents.BaseScene["data"]) => {
return (sceneData: foundry.data.SceneData) => {
const tokens = sceneData.tokens.map((token: TokenDocument) => {
const t = token.toObject();
if (!t.actorId || t.actorLink) {
@ -166,7 +164,7 @@ export function getCompendiumMigrator(
const updateData = getActorUpdateData(doc.toObject());
updateData && (await doc.update(updateData));
} else if (doc instanceof Scene && getSceneUpdateData) {
const updateData = getSceneUpdateData(doc.data);
const updateData = getSceneUpdateData(doc.data as foundry.data.SceneData);
updateData &&
(await doc.update(
updateData as DeepPartial<Parameters<foundry.data.SceneData["_initializeSource"]>[0]>,