Skip to content

global typescript interface cannot be used by defineProps #8612

Closed
@Disservin

Description

@Disservin

Vue version

3.3.4

Link to minimal reproduction

https://github.com/Disservin/vue-ts-error/tree/unresolvable-type/vue-ts-error

Steps to reproduce

Clone the repository and cd into vue-ts-error

npm run build-only


> [email protected] build-only
> vite build

vite v4.3.9 building for production...
✓ 11 modules transformed.
✓ built in 805ms
[vite:vue] [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type

/Users/user/documents/github/vue-ts-error/src/components/VTest.vue
4  |  
5  |  <script setup lang="ts">
6  |  defineProps<Test>();
   |              ^^^^
7  |  </script>
8  |  
file: /Users/user/documents/github/vue-ts-error/src/components/VTest.vue
error during build:
Error: [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type

What is expected?

The build should finish normal and throw no errors.

What is actually happening?

The Test interface cannot be unused for defineProps. You will get

Error: [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type

The current workaround is to explictly import the type and export the interface

VTest.vue

import type { Test } from "@/types/index";

index.d.ts

export interface Test {
    name: string;
}

System Info

No response

Any additional comments?

direct link to the component

direct link to the index

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions