This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type NumberRange<N extends number, A extends number[] = []> = | |
A['length'] extends N ? A : NumberRange<N, [...A, A['length']]> | |
type Upto10 = NumberRange<10> // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
// If TS is too lazy to unwind a deep recursion (depth = 46): | |
type Upto46_ = NumberRange<46> // Type instantiation is excessively deep and possibly infinite | |
// We can reduce it's depth by specifying a bigger initial array (now depth = 36): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const Component = () => { | |
const servicesRef = useRef<HTMLAnchorElement>(null); | |
const isServicesHovered = useHover(servicesRef); | |
return ( | |
<Popover.Root open={isServicesHovered}> | |
<Popover.Trigger asChild> | |
<Link href="/" ref={servicesRef}> | |
Services | |
</Link> |