Typescript: Type 'Timer' is not assignable to type 'null'

When using useRef with Typescript, you should provide a generic argument to specify what is the expected type of the held value.

In your case:

// The `current` value is expected to be a `Timer`, and is initialized to `null`
const Ref = useRef<Timer>(null);

Then Ref.current can be assigned to the result of setInterval.

See this article for more info: https://linguinecode.com/post/how-to-use-react-useref-with-typescript