Skip to content

Commit 958e98e

Browse files
atscottthePunderWoman
authored andcommitted
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
1 parent 90cef52 commit 958e98e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

goldens/public-api/router/index.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@ export interface ViewTransitionInfo {
11141114
ready: Promise<void>;
11151115
updateCallbackDone: Promise<void>;
11161116
skipTransition(): void;
1117+
readonly types: Set<string>;
11171118
};
11181119
}
11191120

packages/router/src/utils/view_transition.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ export interface ViewTransitionInfo {
8080
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/skipTransition
8181
*/
8282
skipTransition(): void;
83+
84+
/**
85+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition#browser_compatibility
86+
* @see https://developer.chrome.com/docs/web-platform/view-transitions/same-document#default_style_and_transition_reference
87+
*/
88+
readonly types: Set<string>;
8389
};
8490
/**
8591
* The `ActivatedRouteSnapshot` that the navigation is transitioning from.
@@ -125,7 +131,8 @@ export function createViewTransition(
125131
// routes (the DOM update). This view transition waits for the next change detection to
126132
// complete (below), which includes the update phase of the routed components.
127133
return createRenderPromise(injector);
128-
});
134+
// TODO(atscott): Types in DefinitelyTyped are not up-to-date
135+
}) as ViewTransition & {readonly types: Set<string>};
129136
const {onViewTransitionCreated} = transitionOptions;
130137
if (onViewTransitionCreated) {
131138
runInInjectionContext(injector, () => onViewTransitionCreated({transition, from, to}));

0 commit comments

Comments
 (0)