If you look at the MDN docs for getOwnPropertyDescriptor it states in the first paragraph that only properties directly present on the object will return a valid property descriptor. So it won't return a valid property descriptor if the property is either a) defined on the objects prototype (or its prototype, recursive) or b) defined in native code. Which is most likely the case this with globalThis.
The Object.getOwnPropertyDescriptor() method returns a property descriptor for an own property (that is, one directly present on an object and not in the object's prototype chain) of a given object.
As @52d6c6af figured out in the comments, DOM elements with IDs are defined on the WindowProperties object, which is part of the prototype chain of the window object.
console.log(Object.getOwnPropertyDescriptor(window.__proto__.__proto__, 'foo'))
<div id="foo"></div>
Also, as a rule of thumb. Don't use globalThis or window to access DOM elements. Use getElementById or querySelector.
const foo0 = globalThis.foo; const foo1 = document.getElementById('foo'); const foo2 = document.querySelector('#foo'); console.log(foo0 === foo1, foo1 === foo2);
<div id="foo"></div>
globalThisinheritsfoofrom some other object.