Skip to content

Commit 39f5bea

Browse files
committed
fix: better typing
1 parent ce8df3b commit 39f5bea

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

examples/46_navigation_api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
},
1717
"devDependencies": {
1818
"@tailwindcss/vite": "^4.1.18",
19-
"@types/dom-navigation": "^1.0.6",
2019
"@types/react": "^19.2.7",
2120
"@types/react-dom": "^19.2.3",
21+
"@types/web": "^0.0.310",
2222
"@vitejs/plugin-react": "^5.1.0",
2323
"babel-plugin-react-compiler": "^1.0.0",
2424
"tailwindcss": "^4.1.18",

examples/46_navigation_api/src/lib/my-router/MyRouter.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ const InnerRouter = ({
905905

906906
// https://github.com/facebook/react/blob/main/fixtures/view-transition/src/components/App.js
907907
useEffect(() => {
908-
const callback = (event: NavigateEvent) => {
908+
const callback = ((event: NavigateEvent) => {
909909
if (
910910
!event.canIntercept ||
911911
// If this is just a hashChange,
@@ -924,10 +924,8 @@ const InnerRouter = ({
924924
const route = parseRoute(url);
925925
console.log(event);
926926
const navigationType = event.navigationType;
927-
// @ts-expect-error not supported yet
928-
const previousIndex = window.navigation.currentEntry.index;
927+
const previousIndex = window.navigation.currentEntry!.index;
929928
event.intercept({
930-
// @ts-expect-error not supported yet
931929
async precommitHandler() {
932930
startTransition(async () => {
933931
// addTransitionType('navigation-' + navigationType);
@@ -958,7 +956,7 @@ const InnerRouter = ({
958956
},
959957
scroll: 'after-transition',
960958
});
961-
};
959+
}) as EventListener;
962960
window.navigation.addEventListener('navigate', callback);
963961
return () => {
964962
window.navigation.removeEventListener('navigate', callback);

pnpm-lock.yaml

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)