News for hackers. Stuff that matters.
Re:TypeScripting the Technical Interview by TheCleric on Monday March 13, 2023 @05:08PM (#35142687)
Here's how I would do it:

    interface IOptionsX {
        x: number;
    }
    
    interface IOptionsY {
        y: number;
    }
    
    const testObj: IOptionsX = {x : 0};
    
    Object.defineProperties(testObj, {
        y: {
            value: 100,
            writable: true
        },
    });
    
    if ('y' in testObj) { // Could also do `&& typeof testObj.y === 'number'` to be VERY sure.
        const testObjWithY = testObj as typeof testObj & IOptionsY;
        console.log(testObjWithY.y)
    }
Re:TypeScripting the Technical Interview by TheCleric on Monday March 13, 2023 @10:46PM (#35146726)
Though honestly I've gotten this far without EVER using defineProperty so I'd probably continue that streak.