From 4585efa1d7371b1f0ef0289c2a627e359fca89ec Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Thu, 31 Oct 2024 05:40:16 -0700 Subject: [PATCH] Fix some type issues --- src/module/roll-table/oracle-table.ts | 5 +++-- src/module/vue/sf-truths.vue | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/module/roll-table/oracle-table.ts b/src/module/roll-table/oracle-table.ts index bf705520c..a16244c20 100644 --- a/src/module/roll-table/oracle-table.ts +++ b/src/module/roll-table/oracle-table.ts @@ -427,9 +427,10 @@ export class OracleTable extends RollTable { // Draw from the cursed table const cursedResult = cursedTable.results.find( (x) => - originalRoll.total >= x.range[0] && originalRoll.total <= x.range[1] + (originalRoll.total ?? -1) >= x.range[0] && + (originalRoll.total ?? -1) <= x.range[1] ) - return { cursedResults: [cursedResult], cursedDie } + return { cursedResults: compact([cursedResult]), cursedDie } } } diff --git a/src/module/vue/sf-truths.vue b/src/module/vue/sf-truths.vue index 8f9053de3..03b6c9d68 100644 --- a/src/module/vue/sf-truths.vue +++ b/src/module/vue/sf-truths.vue @@ -33,7 +33,7 @@ ref="categoryComponents" :key="(truth.je()._id as string)" :je="truth.je" - v-model="categoryModels[truth.je()._id]" + v-model="categoryModels[truth.je()._id ?? '']" /> @@ -75,7 +75,7 @@ async function saveTruths() { // Fetch values from the category components const contentSections: string[] = [] for (const t of props.data.truths) { - const model = categoryModels.value[t.je()._id] + const model = categoryModels.value[t.je()._id ?? ''] if (model.valid) contentSections.push( `

${model.title}