optionDisabled prop on Dropdown wrongly typed #1705
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
vue2-portable
Milestone
I'm submitting a ... (check one with "x")
CodeSandbox Case (Bug Reports)
Not sure how to demonstrate a typescript issue in CodeSandbox unfortunately.
Current behavior
According to the documentation, the
optionDisabled
prop on the Dropdown component should receive "Property name or getter function to use as the disabled flag of an option, defaults to false when not defined."However the Typescript type of this prop is
boolean
.Therefore even thought the functionality works when passing the "Property name" into this prop it results in a Typescript error.
Documentation Screenshot:
Typescript error:
Expected behavior
Typescript typing should match the range of expected values (i.e. include "string" in the typing)
Minimal reproduction of the problem with instructions
Add the following code to a typescript enabled vue component / project and observe above described type error.
<Dropdown :options="[]" optionValue="code" optionLabel="name" optionDisabled="disabled" />
tsconfig.json
value for reference:{ "compilerOptions": { "target": "esnext", "module": "esnext", "moduleResolution": "node", "strict": true, "jsx": "preserve", "sourceMap": true, "resolveJsonModule": true, "esModuleInterop": true, "lib": ["esnext", "dom"], "baseUrl": ".", "types": ["jest"], "paths": { "@/*": ["src/*"] }, "skipLibCheck": true } }
What is the motivation / use case for changing the behavior?
Typescript type errors when passing a string to the optionDisabled prop.
Please tell us about your environment:
MacOS, Vue3 + vite, Typescript
Vue version: 3.X
3.2.11
PrimeVue version: 3.4.X
3.7.2
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Browser independent issue
The text was updated successfully, but these errors were encountered: