· 48 words · 1 min
import { useRef } from 'react';
const ref = useRef<HTMLElement>(null!);
const element = ref.current; // ref.current is HTMLElement
const fruits = ['apple', 'orange', 'banana'] as cosnt;
type FruitsType = typeof fruits;
type Fruit = FruitsType[number]; // 'apple' | 'orange' | 'banana'
More explanation from this thread on X.
To be continued…