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


> test@0.0.0 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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy