patternfly / react-user-feedback

MIT License
1 stars 9 forks source link

Types of `onShareFeedback` and `onJoinMailingList` do not match documented usage #38

Closed vjwilson closed 1 year ago

vjwilson commented 1 year ago

TypeScript linting shows errors for the props onShareFeedback and onJoinMailingList

The docs here, https://react-user-feedback.surge.sh/extensions/react-user-feedback/#feedbackmodalprops, and the examples given above the props list show an option for a function returning a boolean.

onShareFeedback*required    string | (() => boolean)

onJoinMailingList           string | (() => boolean)

but the actual types defined in the published package is only string

Here is an example error message in VSCode:

Type '() => boolean' is not assignable to type 'string'.ts(2322)

FeedbackModal.d.ts(7, 5): The expected type comes from property 'onShareFeedback' which is declared here on type 'IntrinsicAttributes & FeedbackModalProps'

(property) FeedbackModalProps.onShareFeedback: string

dlabaj commented 1 year ago

What version of the extension do you have installed? This should have been fixed in 1.0.7. Here's an example of the callback being called. https://github.com/patternfly/react-user-feedback/blob/main/packages/module/patternfly-docs/content/examples/Advanced.tsx

Also I will create a bug to send back the missing form information for you in the callback.