-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
InputText: Interface 'InputTextProps' incorrectly extends interface 'InputHTMLAttributes'. Password: Interface 'PasswordProps' incorrectly extends interface 'InputHTMLAttributes'. #5480
Comments
I am having issues with this as well. I am working on wrapping PrimeVue, and am unable to extend the associated props for InputText and Password. Other components such as ToggleButton and their props seem to extend just fine. <script setup lang="ts">
import InputText, { InputTextProps } from 'primevue/inputtext';
const props = defineProps<InputTextProps>()
</script>
<template>
<InputText v-bind="{...$attrs, ...props}">
<slot v-for="slot in Object.keys($slots)" :name="slot" :slot="slot"/>
</InputText>
</template> [vite] Internal server error: [@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. |
Same issue here 😭 |
@tugcekucukoglu, @mertsincan , @cagataycivici , please please please - can this be prioritised. Since Prime applies a very composition oriented approach towards Inputs, there is an ever growing need to build your own Input components purely out of DX interest (I don't want to be copy pasting a template of 3 elements in particular order 100 times because my standard input needs to support floating label, helper text and icons all at the same time... I would have chosen Bootstrap otherwise). And this error makes it impossible to achieve this because it involves inevitably extending InputTextProps, which breaks TS. |
I'm also getting an error when I try to create a simple wrapper component... 😭
The wrapper component: <script setup lang="ts">
import type { InputTextProps } from 'primevue/inputtext';
import InputText from 'primevue/inputtext';
const props = defineProps<InputTextProps>();
</script>
<template>
<InputText v-bind="props" />
</template> I'm using EDIT: Just tested it with a fresh Nuxt setup and PrimeVue v4 but still the same error... |
I think this needs to be fixed urgently to be able to use Primevue as UI base while keeping TS functionnalties. I'm having the same issue on the Button component. |
Would be nice to have some reaction from the maintainers 🙏 |
Having same problem here, since InputText does not have built-in error display I am creating a component with a span element to display error messages and I cannot extend my component props from InputText prop. |
For now, using /* @vue-ignore */ before each extend has been "solving" the issue. But seems like a temporary fix. Here is a full extend of the Button component :
|
It's not really a "fix" as you're binding the |
@DjilanoS You're right it doesn't solve the issue and doesn't count as a solution, as the attrs are not interpreted as props. It just allowed better autocompletion for my vscode. |
Same problem, a fix or a reaction from a maintainer would be appreciated |
@tugcekucukoglu ... |
@tugcekucukoglu, why not just rewrite internal types in such cases |
temporary solution is not very desirable, upvoting it too |
@tugcekucukoglu I'm not sure the resolving commit would solve the issue for component like Button (and probably others). |
Describe the bug
tsc --build
fails with the following errors:Reproducer
https://stackblitz.com/edit/vitejs-vite-gkvhqj?terminal=dev
PrimeVue version
3.50.0
Vue version
3.x
Language
ALL
Build / Runtime
TypeScript
Browser(s)
No response
Steps to reproduce the behavior
tsc --build
in the terminalExpected behavior
tsc --build
succeeds without errors.The text was updated successfully, but these errors were encountered: