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

Knob (Typescript): Fix valueTemplate prop type definition #6842

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

StealthC
Copy link
Contributor

@StealthC StealthC commented Nov 23, 2024

###Defect Fixes
Issue #6843
This pull request fixes the TypeScript definition for the valueTemplate prop in the Knob component. The previous type declaration:

valueTemplate?: (val: number) => string | string | undefined;

was incorrect and caused the prop to only accept functions, as string | undefined was interpreted as the return type of the function. This made it impossible to directly assign a string value to the valueTemplate prop.

The updated type:

valueTemplate?: ((val: number) => string | undefined) | string;

correctly allows the prop to accept either:

  • A function that returns string | undefined.
  • A plain string value.
  • Or remain undefined.

This change ensures the valueTemplate prop works as intended with both functions and strings.

(and yes, English is not my primary language, so I used ChatGPT to generate this summary)

Copy link

vercel bot commented Nov 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Updated (UTC)
primevue ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2024 0:53am
primevue-v3 ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2024 0:53am

@tugcekucukoglu tugcekucukoglu merged commit 69a71b6 into primefaces:master Nov 25, 2024
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants