8000 Compatible with tsconfig `allowArbitraryExtensions` option · Issue #13295 · vuejs/core · GitHub
[go: up one dir, main page]

Skip to content

Compatible with tsconfig allowArbitraryExtensions option #13295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Teages opened this issue May 8, 2025 · 1 comment · Fixed by #13301
Closed

Compatible with tsconfig allowArbitraryExtensions option #13295

Teages opened this issue May 8, 2025 · 1 comment · Fixed by #13301
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: compiler

Comments

@Teages
Copy link
Contributor
Teages commented May 8, 2025

Vue version

3.5.13

Link to minimal reproduction

https://github.com/Teages/vue-allow-arbitrary-extensions

Steps to reproduce

  1. enable allowArbitraryExtensions in tsconfig.json
  2. create two files: WithType.vue, WithType.d.vue.ts, add a type export in WithType.d.vue.ts
  3. try to import the type by import type { X } from './WithType.vue'

You can run pnpm i & pnpm play in the reproduction

What is expected?

Vue should load the type from WithType.d.vue.ts as allowArbitraryExtensions was enable and .vue file is not a known JavaScript or TypeScript file extension.

What is actually happening?

Vue try to resolve the type from WithType.vue but not WithType.d.vue.ts, and finally it doesn't find the type and throw a error:

~/main.ts:80
      throw new Error(`[vue-sfc-transformer] ${msg}`);
            ^

Error: [vue-sfc-transformer] Unresolvable type reference or unsupported built-in utility type
    at Object.error (~/main.ts:80:13)
    at innerResolveTypeElements (~/node_modules/.pnpm/@vue+compiler-sfc@3.5.13/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:22104:20)
    at resolveTypeElements (~/node_modules/.pnpm/@vue+compiler-sfc@3.5.13/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:21995:20)
    at resolveRuntimePropsFromType (~/node_modules/.pnpm/@vue+compiler-sfc@3.5.13/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:23632:20)
    at extractRuntimeProps (~/node_modules/.pnpm/@vue+compiler-sfc@3.5.13/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:23608:17)
    at processDefineProps (~/main.ts:57:57)
    at ~/main.ts:24:35

Node.js v22.14.0

System Info

N/A

Any additional comments?

nuxt/module-builder#597
unjs/mkdist#270
unjs/mkdist#268 (comment)
https://github.com/vuejs/core/blob/v3.5.13/packages/compiler-sfc/src/script/resolveType.ts#L1154

microsoft/TypeScript#50133

I can try to make a pull request to fix it if you want.

@edison1105
Copy link
Member

PR welcome~

@edison1105 edison1105 added scope: compiler 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: compiler
Projects
None yet
2 participants
0