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

optionDisabled prop on Dropdown wrongly typed #1705

Closed
ckoopmann opened this issue Oct 27, 2021 · 1 comment
Closed

optionDisabled prop on Dropdown wrongly typed #1705

ckoopmann opened this issue Oct 27, 2021 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working vue2-portable
Milestone

Comments

@ckoopmann
Copy link

ckoopmann commented Oct 27, 2021

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primevue/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=110

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:
image

Typescript error:
image

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

@tugcekucukoglu
Copy link
Member

What is your exact test case? How could we replicate it with using this codesandbox?

@cagataycivici cagataycivici self-assigned this Nov 17, 2021
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Nov 17, 2021
@cagataycivici cagataycivici added this to the 3.9.0 milestone Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working vue2-portable
Projects
None yet
Development

No branches or pull requests

3 participants