'Typescript find out stale/fresh value

I want to determine whether the value is stale or not

If the value is stale, then the type is true and vice versa

stale value is value that attached to a variable

fresh value is value that is not attached to a variable

const a = {a:1}

const result = IsStale(a) // IsStale is a function with generic, don't care about the runtime

type Result = typeof result // true

const result2 = IsStale({a:1})

type Result2 = typeof result2 // false

so what is IsStale? Or it is impossible?

playground



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source