From 9727542907def7ff54542ddf882659e83a66fbe9 Mon Sep 17 00:00:00 2001 From: Stephen Davies Date: Thu, 29 Feb 2024 00:17:42 +1100 Subject: [PATCH] Discriminate between ChartableMixin models and References --- lib/ModelMixins/ChartableMixin.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ModelMixins/ChartableMixin.ts b/lib/ModelMixins/ChartableMixin.ts index b3884db2a77..b5da05a73a3 100644 --- a/lib/ModelMixins/ChartableMixin.ts +++ b/lib/ModelMixins/ChartableMixin.ts @@ -68,6 +68,10 @@ type BaseType = Model; function ChartableMixin>(Base: T) { abstract class ChartableMixin extends Base { + get hasChartableMixin() { + return true; + } + get isChartable() { return true; } @@ -85,7 +89,7 @@ namespace ChartableMixin { export interface Instance extends InstanceType> {} export function isMixedInto(model: any): model is Instance { - return model && model.isChartable; + return !!model?.hasChartableMixin; } }