How to define type with function overriding?

To give a little background i was initially facing this issue and as shared by the solution, it make sense to let the type to be flexible depending on the context

However, I found out that it isnt really working on my end

let timeoutId: null | ReturnType<typeof setTimeout> = null

timeoutId = setTimeout(...)

With the code above, i’m getting Type 'number' is not assignable to type 'Timeout'.ts(2322).

When I hover over timeoutId, I got let timeoutId: NodeJS.Timeout | null, while hovering over setTimeout, i see below

function setTimeout(handler: any, timeout?: any, ...args: any[]): number (+2 overloads)
namespace setTimeout

Is there any way to go about it? I think the root cause is due to function overriding