patternfly-react icon indicating copy to clipboard operation
patternfly-react copied to clipboard

chore(Tooltip): converted examples to typescript

Open andyyvo opened this issue 3 years ago • 3 comments

What: Closes #8029 . TypeScript examples for Tooltip.

Additional issues:

andyyvo avatar Sep 23 '22 18:09 andyyvo

Firstly, in lines 37, 50, 63, and 76 of TooltipOptions.tsx, is this good practice? I was thinking of typing updatedTrigger as let updatedTrigger: string[] = []; as a result of what the expected input should be.

andyyvo avatar Sep 23 '22 18:09 andyyvo

Preview: https://patternfly-react-pr-8052.surge.sh

A11y report: https://patternfly-react-pr-8052-a11y.surge.sh

patternfly-build avatar Sep 23 '22 18:09 patternfly-build

The main issue I'm running into is lines 109 (setPosition(selection)) and 170 (setFlipBehavior(selection)). The error I am seeing is

Argument of type 'string | SelectOptionObject' is not assignable to parameter of type 'SetStateAction<TooltipPosition>'.
  Type 'string' is not assignable to type 'SetStateAction<TooltipPosition>'.

This is due to Select component onSelect prop method taking in value: string | SelectOptionObject whereas setPosition and setFlipBehavior have the type (value: React.SetStateAction<TooltipPosition>) => void. I'm unsure how to convert the string or SelectOptionObject to this type

andyyvo avatar Sep 23 '22 19:09 andyyvo

@andyyvo I'm going to update this PR with the tiny change to move it along :)

nicolethoen avatar Nov 16 '22 21:11 nicolethoen

Your changes have been released in:

Thanks for your contribution! :tada:

patternfly-build avatar Nov 30 '22 21:11 patternfly-build