diff --git a/src/Testing/renderWithModel.ts b/src/Testing/renderWithModel.ts index 8d232f6..51e1776 100644 --- a/src/Testing/renderWithModel.ts +++ b/src/Testing/renderWithModel.ts @@ -10,7 +10,7 @@ import { RenderWithModelOptions, setFakeOptions } from "./fakeOptions"; * @param {(TModel | RenderWithModelOptions)} options The model or an options object. * @returns {TResult} The returned value of the `render` function. */ -function renderWithModel (render: () => TResult, options: TModel | RenderWithModelOptions): TResult { +function renderWithModel (render: () => TResult, options: TModel | RenderWithModelOptions): TResult { if ("model" in options && "dispatch" in options) { setFakeOptions(options as RenderWithModelOptions); } else { diff --git a/src/useElmish.ts b/src/useElmish.ts index 5dc51f4..aa1d98c 100644 --- a/src/useElmish.ts +++ b/src/useElmish.ts @@ -160,9 +160,8 @@ function callUpdate (update: UpdateFun } function callUpdateMap (updateMap: UpdateMap, msg: TMessage, model: TModel, props: TProps): UpdateReturnType { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-expect-error -- We know that msg fits - const updateFn = updateMap[msg.name as TMessage["name"]] as (msg: TMessage, model: TModel, props: TProps) => UpdateReturnType; + const msgName: TMessage["name"] = msg.name; + const updateFn = updateMap[msgName] as (msg: TMessage, model: TModel, props: TProps) => UpdateReturnType; return updateFn(msg, model, props); }