Skip to content

Vue: defineProps<T>() with an imported type fails on TypeScript 7 #932

Backlog

Description

@hyfdev

On TypeScript 7, defineProps<T>() with an imported T fails to compile in Vue components that Void doesn't treat as pages, such as _error.vue, _not-found.vue, and components used by pages:

[@vue/compiler-sfc] No fs option provided to `compileScript` in non-Node environment. File system access is required for resolving imported types.

New Vue starters install TypeScript 7, so the documented _error.vue fails once it's added, because ErrorPageProps comes from @void/vue.

Its dev request returns 500 and the build fails.

Pages work, because Void removes their defineProps type arguments before Vue compiles them.

Vue's compiler resolves imported types through TypeScript's classic API, which TypeScript 7 no longer exports.

vuejs/core#15085 (open) makes the compiler fall back to @typescript/typescript6, which TypeScript 7 projects would then need to install.

What I considered

  • Have Void replace the imported type in _error.vue and _not-found.vue with an inline { error: object } before Vue compiles them. Unlike pages, they can't just drop the type, because they need error declared.
  • Install TypeScript 6 in new Vue starters. pnpm-workspace.yaml already pins TypeScript 6.0.3 for the repo's Angular and SvelteKit apps, which require it.

I was going to fix it the first way, but I don't think it's the right direction: the bug is in Vue's compiler, the rewrite only accepts the documented form, and regular components stay broken.

#933 is a workaround for new projects only.

I'll raise it with the Vue team and update here.

Activity

  1. hyfdev commented on Nov 27, 2026

    @hyfdev
    ContributorAuthor

    #933 makes new Vue starters install TypeScript 6, so new projects aren't affected. The fix belongs in Vue's compiler, and the Vue team has put both PRs for it (vuejs/core#15085, vuejs/core#15999) on hold until TypeScript 7.1 ships its new compiler API as stable; it's tracked in vuejs/core#15997. I'll leave this open until Vue supports TypeScript 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions