ore-ui icon indicating copy to clipboard operation
ore-ui copied to clipboard

Suppress twoslash implicit type error on hook examples

Open kalkafox opened this issue 3 years ago • 0 comments

The error annotation for the twoslash code blocks on the useFacetState and useFacetCallback produce a visual error on the markdown in the documentation, warning of an implicit any type.

Whether this was intentional or not, I believe the TypeScript is correct enough to not warrant a drastic change of an example, since it doesn't cause a compiling error in React, but if such an annotation was intended, I do apologize for the misplacement.

The solution to fix this error without requiring the suppression of the error annotation would be to declare the type within the useCallback React function:

  const handleChange = useCallback(
-   (event) => {
+   (event: any) => {
      setValue((event.target as HTMLInputElement).value)
    },
    [setValue],
  )

This, of course, is a change to the documentation itself, and I felt was not necessary. Any changes and such are welcome of course, just figured I'd help!

Take care.

kalkafox avatar Aug 10 '22 12:08 kalkafox