fix(router): Add missing types to transition (#60307)

The 'types' property was added recently and is available in all browsers that support view transitions

fixes #60285

PR Close #60307
This commit is contained in:
Andrew Scott
2025-03-10 09:19:42 -07:00
committed by Jessica Janiuk
parent 0142ae1c8e
commit 1226eaad51
2 changed files with 9 additions and 1 deletions
+1
View File
@@ -1117,6 +1117,7 @@ export interface ViewTransitionInfo {
ready: Promise<void>;
updateCallbackDone: Promise<void>;
skipTransition(): void;
readonly types: Set<string>;
};
}
+8 -1
View File
@@ -80,6 +80,12 @@ export interface ViewTransitionInfo {
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/skipTransition
*/
skipTransition(): void;
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition#browser_compatibility
* @see https://developer.chrome.com/docs/web-platform/view-transitions/same-document#default_style_and_transition_reference
*/
readonly types: Set<string>;
};
/**
* The `ActivatedRouteSnapshot` that the navigation is transitioning from.
@@ -125,7 +131,8 @@ export function createViewTransition(
// routes (the DOM update). This view transition waits for the next change detection to
// complete (below), which includes the update phase of the routed components.
return createRenderPromise(injector);
});
// TODO(atscott): Types in DefinitelyTyped are not up-to-date
}) as ViewTransition & {readonly types: Set<string>};
const {onViewTransitionCreated} = transitionOptions;
if (onViewTransitionCreated) {
runInInjectionContext(injector, () => onViewTransitionCreated({transition, from, to}));