Skip to content

Commit

Permalink
Discriminate between ChartableMixin models and References
Browse files Browse the repository at this point in the history
  • Loading branch information
steve9164 committed Feb 28, 2024
1 parent 84fb691 commit 9727542
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/ModelMixins/ChartableMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ type BaseType = Model<ModelTraits>;

function ChartableMixin<T extends AbstractConstructor<BaseType>>(Base: T) {
abstract class ChartableMixin extends Base {
get hasChartableMixin() {
return true;
}

get isChartable() {
return true;
}
Expand All @@ -85,7 +89,7 @@ namespace ChartableMixin {
export interface Instance
extends InstanceType<ReturnType<typeof ChartableMixin>> {}
export function isMixedInto(model: any): model is Instance {
return model && model.isChartable;
return !!model?.hasChartableMixin;
}
}

Expand Down

0 comments on commit 9727542

Please sign in to comment.