Skip to content

Commit

Permalink
Fix unnecessary non-nil assertion after TS upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
thegedge committed May 9, 2024
1 parent 14ba546 commit 62fe068
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/union.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import memoize from "lodash.memoize";
import type { UnionOptions as MSTUnionOptions } from "mobx-state-tree";
import { types as mstTypes } from "mobx-state-tree";
import { isModelType, isType } from "./api";
import { BaseType } from "./base";
import { ensureRegistered, isClassModel } from "./class-model";
import type { IAnyType, InstanceWithoutSTNTypeForType, TreeContext, IStateTreeNode, IUnionType } from "./types";
import { InvalidDiscriminatorError } from "./errors";
import { OptionalType } from "./optional";
import { isModelType, isType } from "./api";
import { LiteralType } from "./simple";
import { InvalidDiscriminatorError } from "./errors";
import type { IAnyType, IStateTreeNode, IUnionType, InstanceWithoutSTNTypeForType, TreeContext } from "./types";
import { cyrb53 } from "./utils";

export type ITypeDispatcher = (snapshot: any) => IAnyType;
Expand Down Expand Up @@ -109,7 +109,7 @@ class UnionType<Types extends IAnyType[]> extends BaseType<

super(
mstTypes.union(
{ ...options, dispatcher: dispatcher ? (snapshot) => dispatcher!(snapshot).mstType : undefined },
{ ...options, dispatcher: dispatcher ? (snapshot) => dispatcher(snapshot).mstType : undefined },
...types.map((x) => x.mstType),
),
);
Expand Down

0 comments on commit 62fe068

Please sign in to comment.