Skip to content
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

Extending InputTextProps: Failed to resolve extends base type. #6978

Closed
Shin-- opened this issue Dec 19, 2024 · 1 comment
Closed

Extending InputTextProps: Failed to resolve extends base type. #6978

Shin-- opened this issue Dec 19, 2024 · 1 comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@Shin--
Copy link

Shin-- commented Dec 19, 2024

Describe the bug

Trying to wrap InputText in a custom component like so:

import type { InputTextProps } from 'primevue/inputtext'
interface Props extends InputTextProps {
  icon: string
}
const props = defineProps<Props>()

leads to:

> [@vue/compiler-sfc] Failed to resolve extends base type.
If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example:

interface Props extends /* @vue-ignore */ Base {}

Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.

/my/path/CustomInputGroup.vue
21 |  
22 |  
23 |  interface Props extends InputTextProps {
   |                          ^^^^^^^^^^^^^^
24 |    icon: string
25 |  }

There has been an issue for another bug where this problem was also talked about:

#5480

That issue has been closed around a month ago after the extend had been removed from InputTextProps: d397280#diff-fd5388a3530408f2bf6b8999987f26337bc58eaa03e12e20dcf0dbf3e9d4e656

A new extends was added a few days later though:
442026d#diff-fd5388a3530408f2bf6b8999987f26337bc58eaa03e12e20dcf0dbf3e9d4e656

Is there another way to wrap components and this one is not the intended way?

Reproducer

https://stackblitz.com/edit/primevue-4-ts-vite-issue-template-3ecdeusa?file=src%2Fcomponents%2FCustomInputGroup.vue

PrimeVue version

4.2.5

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

Define interface that extends InputTextProps. Breaks. Also passing InputTextProps directly into defineProps breaks.

Expected behavior

InputTextProps can be reused to wrap and extend the existing component(s)

@Shin-- Shin-- added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 19, 2024
@tugcekucukoglu
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

2 participants