sequence callback function parameter implicitly has any type
Closed this issue · 1 comments
MeDarwin commented
in the docs, it says if you use useRef
hooks, it has generic type from react createRef
and the default is HTMLSpanElement
. however when I do it the callback function way, the parameter has the type of any
and it seems like I cannot infer the type to anything including HTMLElement
as it doesnt satisfy the Sequence
type in <TypeAnimation />
props.
Is there any way I can infer the parameter type from any
to any HTMLElement
in callback function?
MeDarwin commented
I solved the issue by adding or null
into the type as the parameter in callback function can be null.
so the callback function is written like this:
(el: HTMLElement | null) => {
console.log(el)
}