Skip to content

Commit 1226eaa

Browse files
atscottthePunderWoman
authored andcommitted
fix(router): Add missing types to transition (angular#60307)
The 'types' property was added recently and is available in all browsers that support view transitions fixes angular#60285 PR Close angular#60307
1 parent 0142ae1 commit 1226eaa

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
@@ -1117,6 +1117,7 @@ export interface ViewTransitionInfo {
11171117
ready: Promise<void>;
11181118
updateCallbackDone: Promise<void>;
11191119
skipTransition(): void;
1120+
readonly types: Set<string>;
11201121
};
11211122
}
11221123

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)