From 1a6b55ff2187fb4800b844eeae0c78e6f716b3ae Mon Sep 17 00:00:00 2001 From: Trim21 Date: Tue, 1 Nov 2022 18:24:22 +0800 Subject: [PATCH] fix LooseTriggerSet type --- types/trigger.d.ts | 10 +++++----- ui/raidboss/popup-text.ts | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/types/trigger.d.ts b/types/trigger.d.ts index b33d95535c..209dd30858 100644 --- a/types/trigger.d.ts +++ b/types/trigger.d.ts @@ -106,10 +106,10 @@ export type TriggerField = Omit, 'type' | 'netRegex'>; +export type BaseTrigger = Omit< + BaseNetTrigger, + 'type' | 'netRegex' +>; type BaseNetTrigger = { id: string; @@ -203,7 +203,7 @@ export type LooseTimelineTrigger = Partial>; export type LooseTrigger = Partial & PartialRegexTrigger>; export type LooseTriggerSet = - & Exclude>, 'triggers' | 'timelineTriggers'> + & Omit>, 'triggers' | 'timelineTriggers'> & { /** @deprecated Use zoneId instead */ zoneRegex?: diff --git a/ui/raidboss/popup-text.ts b/ui/raidboss/popup-text.ts index ee32aba71e..c0c4f492e1 100644 --- a/ui/raidboss/popup-text.ts +++ b/ui/raidboss/popup-text.ts @@ -718,7 +718,7 @@ export class PopupText { // time later. This will clobber each time we // load this, but that's ok. trigger.filename = setFilename; - const id = trigger.id; + const id = trigger.id ?? trigger.toString(); if (!isRegexTrigger(trigger) && !isNetRegexTrigger(trigger)) { console.error(`Trigger ${id}: has no regex property specified`); @@ -762,7 +762,7 @@ export class PopupText { trigger.localNetRegex = Regexes.parse(localeNetRegex); orderedTriggers.push(trigger); found = true; - } else if (defaultNetRegex !== undefined) { + } else if (defaultNetRegex) { // simple netRegex trigger, need to build netRegex and translate if (defaultNetRegex instanceof RegExp) { const trans = translateRegex(defaultNetRegex, this.parserLang, set.timelineReplace); @@ -787,7 +787,7 @@ export class PopupText { } if (!found) { - console.error('Trigger ' + trigger.id + ': missing regex and netRegex'); + console.error(`Trigger ${id}: missing regex and netRegex`); continue; } }