How would you implement a minimal promise from scratch?
A promise is really just a state machine. It has three states, it holds one value, and it keeps a queue of the functions that want to run when the promise settles. That is the whole idea, and the parts that people leave out when they write a small version are about working with the real promise library and not about the core idea.
The three states are pending, fulfilled, and rejected. A promise starts as pending and settles exactly once. Settling means it moves from pending to fulfilled or rejected, and it can only do that one time. Every later attempt to settle it again is ignored.
The queue holds the handlers that were registered before the promise settled. When the promise settles, the queue is emptied and every handler in it runs. If the promise was already settled when a handler was registered, that handler runs in a microtask instead, and that is what keeps the timing the same in both cases.
Two details are what make the real thing hard. The first is that then has to return a new promise, so that whatever a handler returns can be resolved or rejected in turn, and that is what makes chaining work. The second is that resolving a promise is more than calling a resolve function. If you resolve with another promise, the first promise takes on the state of the second one, and that is why you can return a promise from an async function.
Here is what you can leave out in an interview version. You can leave out the rule about adopting the state of another promise, the special handling for subclasses, and the careful ordering between the queued handlers and the immediate ones. What you must not leave out is the single settlement, the queue, and the fact that the handlers run later instead of running during the call to then.