Skip to content

chore(vue): enable strict type checking in vue and vue-router - #31320

Open
ShaneK wants to merge 1 commit into
major-9.0from
FW-7656
Open

chore(vue): enable strict type checking in vue and vue-router#31320
ShaneK wants to merge 1 commit into
major-9.0from
FW-7656

Conversation

@ShaneK

@ShaneK ShaneK commented Aug 3, 2026

Copy link
Copy Markdown
Member

Issue number: internal


What is the current behavior?

Currently, packages/vue and packages/vue-router are the only framework packages that don't set strict, and neither sets rootDir. Turning strict on surfaces 61 pre-existing errors, 41 in @ionic/vue (24 of them in IonTabBar) and 20 in @ionic/vue-router.

Nothing reports them today. The rollup build prints type errors as (!) Plugin typescript: warnings and still exits 0, and there's no tsc --noEmit step in either CI action, so a type error cannot fail a build.

Two of the errors are actual bugs, which I went ahead and fixed here.

What is the new behavior?

Both packages now set strict and rootDir: "src" and typecheck clean. Most of the 61 fixes are null guards and signatures that were lying about what they returned. getTabsHistory was declared (tab: string) => RouteInfo[] but everything using this was already treating it as string | undefined anyway. tabs: {} in IonTabBar's data inferred {} rather than the TabState interface already declared in the same file. _tabsWillChange and _tabsDidChange were initialized to a Vue prop-descriptor object instead of a function, which is why calling them wasn't type-safe.

Changing rootDir didn't do actually anything here, it just makes us consistent. @rollup/plugin-typescript already infers src as the common root, and I verified dist/ for both packages with and without it to confirm nothing changed.

Both bugs above are fixed.

One behavior change worth calling out: Pressing back with no defaultHref and nothing in history used to call router.replace(undefined), which vue-router resolves against the current location and then rejects as NAVIGATION_DUPLICATED, so it already did nothing. That path now returns without navigating, matching @ionic/react-router, and it also clears the pop/back incomingRouteParams that the old code left staged for the next navigation to pick up. ion-back-button also reads the backButtonDefaultHref config now. Core resolves that config itself and only renders the button once it has a href, so a config-only back button was previously visible but did nothing.

CI now runs a typecheck script in both build-vue and build-vue-router, between lint and build, preventing us from having to do this cleanup again in the future.

Does this introduce a breaking change?

  • Yes
  • No

Other information

This will conflict with @thetaPC's PR, #31280. I'm okay waiting for that one to merge and then resolving the issues, though.

@ShaneK
ShaneK requested a review from a team as a code owner August 3, 2026 20:52
@ShaneK
ShaneK requested a review from BenOsodrac August 3, 2026 20:52
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview Aug 3, 2026 8:52pm

Request Review

@github-actions github-actions Bot added the package: vue @ionic/vue package label Aug 3, 2026
@ShaneK
ShaneK requested review from thetaPC and removed request for BenOsodrac August 3, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant