primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.84k stars 1.24k forks source link

Tabs: Mismatch between prop "value" and emit update:value #6825

Closed antej85 closed 4 days ago

antej85 commented 4 days ago

Describe the bug

Prop: value is of type string | number but emit update:value only has type number which causes TS error.

Change to update:value: string | number

error TS2322: Type '(tabName: string) => void' is not assignable to type '(value: number) => void'. Types of parameters 'tabName' and 'value' are incompatible. Type 'number' is not assignable to type 'string'.

17 @update:value="onTabChange">

Reproducer

https://stackblitz.com/edit/primevue-4-ts-vite-issue-template-jg7u4u?file=README.md

PrimeVue version

4.2.2

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

Add tabs component, set value=""

@update:value="funcThatTakesStringAsArgument"

const funcThatTakesStringAsArgument = (tabName: string) => console.log(tabName);

run ts check: vue-tsc --noEmit

Expected behavior

No response

tugcekucukoglu commented 4 days ago

Fixed with: https://github.com/primefaces/primevue/commit/ff7d46e78dd1a9913b3ff681b06a10e086be5eef