-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Open
Labels
🍰 p2-nice-to-havePriority 2: this is not breaking anything but nice to have it addressed.Priority 2: this is not breaking anything but nice to have it addressed.has PRA pull request has already been submitted to solve the issueA pull request has already been submitted to solve the issuescope: compilerscope: script-setup
Description
Vue version
3.3.4
Link to minimal reproduction
Steps to reproduce
type Foo = { foo: number; }
type SomeProps<T> = T & { isVisible: boolean }
What is expected?
this should be valid typescript:
What is actually happening?
compile error:
1:55:02 AM [vite] Internal server error: [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type
/testdir/src/FooItem.vue
1 | <script setup lang="ts">
2 | type Foo = { foo: number }
3 | type SomeProps<T> = T & { isVisible: boolean }
| ^
4 |
5 | defineProps<SomeProps<Foo>>()
Plugin: vite:vue
File: /testdir/src/FooItem.vue
at ScriptCompileContext.error (/testdir/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:15841:11)
at innerResolveTypeElements (/testdir/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17966:20)
at resolveTypeElements (/testdir/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17902:35)
at /testdir/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17924:31
at Array.map (<anonymous>)
at innerResolveTypeElements (/testdir/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17924:20)
at resolveTypeElements (/testdir/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17902:35)
at innerResolveTypeElements (/testdir/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17947:16)
at resolveTypeElements (/testdir/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17902:35)
at resolveRuntimePropsFromType (/testdir/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19312:20)
System Info
System:
OS: macOS 12.0.1
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 44.49 GB / 64.00 GB
Shell: 5.1.4 - /usr/local/bin/bash
Binaries:
Node: 16.20.0 - ~/.nvm/versions/node/v16.20.0/bin/node
npm: 8.19.4 - ~/.nvm/versions/node/v16.20.0/bin/npm
Browsers:
Chrome: 113.0.5672.126
Chrome Canary: 116.0.5806.0
Firefox: 111.0
Safari: 15.1
Safari Technology Preview: 15.4
npmPackages:
vue: ^3.3.2 => 3.3.4
Any additional comments?
I'm not actually sure if I'm characterizing this correctly, but it seems like the sfc compiler cannot handle props whose type intersects one of its own generic parameters.
full pnpm lockfile if that's useful: https://gist.github.com/superfreddialpad/248efe40250d772938f31a2440e54e35
Flashantik, zhou-ouha and brolnickij
Metadata
Metadata
Assignees
Labels
🍰 p2-nice-to-havePriority 2: this is not breaking anything but nice to have it addressed.Priority 2: this is not breaking anything but nice to have it addressed.has PRA pull request has already been submitted to solve the issueA pull request has already been submitted to solve the issuescope: compilerscope: script-setup
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
justin-schroeder commentedon Jun 6, 2023
Pretty sure this is a duplicate of #8468
edison1105 commentedon Jun 7, 2023
@justin-schroeder They're not exactly the same.
sevilyilmaz commentedon Oct 23, 2023
I get the same error when I use an imported type as an alias. I'm not 100% sure if these errors are related.
Here is the link for reproduction: https://play.vuejs.org/#eNqFU8lu2zAQ/ZUBL24LVz6kJ0UJ0BYpkB7aoDV64kXLWGZCkQSH8gJD/94hJTtCUTgncRZy3jI6ic/OZbseRS4Kqr1yAQhD70CXpr2TIpAU99IAqM5ZH+CbtY8BO9h428EiW01xfGIR22prKMDGWriDU/zm8GkJVelzWGxRa7tYgqI/ilSlMYfge4ThVhppitU4n6dxwG86XQZMs4vz1N3HSpmGYfHDUsCKq8Vq1sohhaOOx8o2RzjF21VZv7Te9qbJodIc8LgIVFsGtd+qgCkxJAjTbbEUM2ZviDNJE44O4QOUBOu5PFnME4sjTYMbZfDJW0fFOkvf+3fvr1Nv1I5p09bueeBFOZ47aZxEhmEoVtz5rx5MIxBbslFt9kzWMJEkiRS17ZzS6H+6oNgyKfJRrFgr2ab995SL/izP+XqL9ct/8s90iDkpnjwS+h2ju9RC6VsMY/nh9w888PlS7GzTRy5Xir+QrO4jxrHtC9vIsGd9Ce1jskCZdk0Ph4CGzqQi0ORu6peC3fx6hfor3JvsZtqKYVyG0ccsEIuIh1fHk41p22d7XVmrsTS34x9AwTM03nMx/AVHMyjZ
fix(compiler-sfc): support inferring generic types (#8511)
Trandx commentedon Dec 4, 2023
Hello !!
I have done
pnpm update
after your update but, i always have the same error.this is my code
`export default interface IDynamicSelectInput<E, K, L>{
//props: PropsType & L;
props: PropsType & L
emits: EmitsType;
}`
this is error
`[plugin:vite:vue] [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type
/home/trandx/dev/Nucle-x/sso/_mono/packages/ui/src/components/atoms/list/index.ts
11 | //(event: "change", elt: OptionsType | OptionsType[] ): void;
12 | //(event: 'remove'): void
13 | } & T;
| ^
14 |
15 | type optionFormatType = { name: string; value: valType };`
2 remaining items
adampolyanskiy commentedon Dec 20, 2023
I am not sure if it is connected, but I have simillar problem even after updating from 3.3.4 to 3.3.13
ApiAuditGetRequest extends ApiGetRequestParams.
And I am getting:
[plugin:vite:vue] [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type
adambiggs commentedon Apr 24, 2024
We ran into this when trying to use zod type inference.
ClementNerma commentedon Jun 8, 2024
I still have problems with generic on the latest version. Even the simple following code fails to compile:
Trandx commentedon Jun 9, 2024
vkrepkiy commentedon Jun 17, 2024
I tried to re-use vuetify component's props
type FormInputProps = VTextField['$props']
and as under the hood Vuetify exports viaInstanceType<typeof VTextField>
, also ended up with error[@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type
version 3.4.29
rcomesan commentedon Jun 20, 2024
I'm also getting the same error when trying to import an inferred zod type
[plugin:vite:vue] [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type
I'm importing it inside script setup:
Trandx commentedon Jun 20, 2024
Sinled commentedon Jul 24, 2024
Any updates here? I am having this problem when importing
InferType
from yuppavlo-hadzheha commentedon Aug 1, 2024
I get a similar error when using prop extraction from the element-plus library.
juni0r commentedon Sep 26, 2024
We massively rely on inferred types from zod schemas and run into this issue. Is this a design limitation of
@vue/compiler-sfc
or something that can be fixed?pagination
nuxt/ui#3177arthurseredaa commentedon Jun 5, 2025
Hi! I'm also getting error while use zod inference in vue setup
[plugin:vite:vue] [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type
types.ts
SomePage.vue
Is there any workaround? It seem like current workaround is just manually create types based on zod schema, but that's not the best approach
imyourm8 commentedon Jun 15, 2025
Problem still persists with inferred types from zod schema.