When analyzing the code in the shared playground (Playground Link), the compiler is showing an error indicating that Object is possibly 'null'.
Could there be any scenario where the refresh
function could be called, leading to a situation where viewer
ends up being null despite having an early return check for null in the topLayer
function?
If not, have you considered why TypeScript fails to narrow down this possibility in cases involving nested functions?