From 249d52a3ff17f792c451ea0e42b97a209667290c Mon Sep 17 00:00:00 2001 From: Martin Trapp <94928215+martrapp@users.noreply.github.com> Date: Mon, 10 Mar 2025 11:48:50 +0100 Subject: [PATCH] Extend the simulated viewTransition object with the property (#13381) --- .changeset/every-birds-stick.md | 5 +++++ packages/astro/src/transitions/router.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/every-birds-stick.md diff --git a/.changeset/every-birds-stick.md b/.changeset/every-birds-stick.md new file mode 100644 index 0000000000..fe9ea78906 --- /dev/null +++ b/.changeset/every-birds-stick.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Adds the `types` property to the viewTransition object when the ClientRouter simulates parts of the View Transition API on browsers w/o native support. diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index 0af04940a4..27f7ca6ba6 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -508,7 +508,6 @@ async function transition( // // "finished" resolves after all animations are done. - // @ts-expect-error the internal type `types` isn't provided and not even documented on MDN currentTransition.viewTransition = { updateCallbackDone: updateDone, // this is about correct ready: updateDone, // good enough @@ -520,6 +519,7 @@ async function transition( // This cancels all animations of the simulation document.documentElement.removeAttribute(OLD_NEW_ATTR); }, + types: new Set(), // empty by default }; } // In earlier versions was then'ed on viewTransition.ready which would not execute