#`#shared` types. Failed to resolve extends base type.
9 messages · Page 1 of 1 (latest)
Hi @violet creek. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
I apologize, but the knowledge sources provided do not contain specific information about the #shared functionality or the error you're encountering with resolving extends base types. The documents don't mention this particular feature or error message.
However, based on the general information about Nuxt and TypeScript support, I can suggest a few things to check:
-
Make sure your Nuxt version is up to date, as the
#sharedfunctionality might be a recent feature. -
Verify that your
tsconfig.jsonis correctly set up. Nuxt automatically generates a.nuxt/tsconfig.jsonfile with recommended configurations Nuxt TypeScript docs (https://nuxt.com/docs/guide/concepts/typescript#nuxttsconfigjson). -
Check if your
nuxt.config.tsfile has any custom TypeScript configurations that might interfere with type resolution. -
Ensure that the types in your
./shared/types/Budget.tsfile are correctly exported and don't have any circular dependencies.
If the issue persists, you might want to:
- Check the open issues on the Nuxt GitHub repository (https://github.com/nuxt/nuxt/issues) to see if this is a known issue.
- Consider reporting this as a potential bug (https://nuxt.com/docs/community/getting-help#could-there-be-a-bug) if you can't find a solution, as it might be related to the new
#sharedfunctionality.
For more accurate assistance, you may need to provide additional details about your setup and configuration.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@violet creek Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I'm trying to use the shared types for my component props, for example:
This is my ./shared/types/Budget.ts
export interface BudgetItem {
name: string
available: number
}
export interface BudgetCategory {
name: string
items: BudgetItem[]
}
export interface Budget {
name: string
categories: BudgetCategory[]
}
This is my ./app/components/Budget/Item.vue
<script setup lang="ts">
interface Props extends BudgetItem {}
defineProps<Props>()
</script>
<template>
<div>
<div>{{ name }}</div>
<div>{{ available }}</div>
</div>
</template>
Reproduction: https://codesandbox.io/p/devbox/lrzygp
Issue opened: https://github.com/nuxt/nuxt/issues/30213
I've run into this issue since this feature was first released. Hard to tell if this is a bug or a known limitation of vue. However, for now, I'm just importing these directly from '#shared'
If I try that in my script setup, I get Cannot find module '#shared' or its corresponding type declarations.