Activate strict mode

This commit is contained in:
Johannes Loher 2021-02-07 13:51:20 +01:00
parent 3c47b06f71
commit 09b4117306
9 changed files with 78 additions and 63 deletions

View file

@ -1,7 +1,7 @@
import { migrate as migrate001 } from "./migrations/001";
async function migrate(): Promise<void> {
if (!game.user.isGM) {
if (!game.user?.isGM) {
return;
}
@ -18,14 +18,14 @@ async function migrate(): Promise<void> {
}
async function migrateFromTo(oldMigrationVersion: number, targetMigrationVersion: number): Promise<void> {
if (!game.user.isGM) {
if (!game.user?.isGM) {
return;
}
const migrationsToExecute = migrations.slice(oldMigrationVersion, targetMigrationVersion);
if (migrationsToExecute.length > 0) {
ui.notifications.info(
ui.notifications?.info(
game.i18n.format("DS4.InfoSystemUpdateStart", {
currentVersion: oldMigrationVersion,
targetVersion: targetMigrationVersion,
@ -40,7 +40,7 @@ async function migrateFromTo(oldMigrationVersion: number, targetMigrationVersion
await migration();
game.settings.set("ds4", "systemMigrationVersion", currentMigrationVersion);
} catch (err) {
ui.notifications.error(
ui.notifications?.error(
game.i18n.format("DS4.ErrorDuringMigration", {
currentVersion: oldMigrationVersion,
targetVersion: targetMigrationVersion,
@ -54,7 +54,7 @@ async function migrateFromTo(oldMigrationVersion: number, targetMigrationVersion
}
}
ui.notifications.info(
ui.notifications?.info(
game.i18n.format("DS4.InfoSystemUpdateCompleted", {
currentVersion: oldMigrationVersion,
targetVersion: targetMigrationVersion,