From 2c9e161d3eea918e7e42d581af5d85db0690a21f Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Sun, 14 Nov 2021 14:53:41 +0100 Subject: [PATCH] [fix] more specific return type for crossfade People with "noUncheckedIndexedAccess" set to true in their tsconfig would get false errors when accessing the return type because without this spefici tuple typing, TS infers this as being an array of functions, not a tuple of functions. Fixes #6926 --- src/runtime/transition/index.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/runtime/transition/index.ts b/src/runtime/transition/index.ts index 8f5a9521b6..9315cd77d5 100644 --- a/src/runtime/transition/index.ts +++ b/src/runtime/transition/index.ts @@ -212,7 +212,20 @@ type ClientRectMap = Map; export function crossfade({ fallback, ...defaults }: CrossfadeParams & { fallback?: (node: Element, params: CrossfadeParams, intro: boolean) => TransitionConfig; -}) { +}): [ + ( + node: Element, + params: CrossfadeParams & { + key: any; + } + ) => () => TransitionConfig, + ( + node: Element, + params: CrossfadeParams & { + key: any; + } + ) => () => TransitionConfig +] { const to_receive: ClientRectMap = new Map(); const to_send: ClientRectMap = new Map();