export const isFulfilled = (promise: PromiseSettledResult): promise is PromiseFulfilledResult => promise.status === 'fulfilled'; // TS<5 does not support `in` operator for type narrowing. once we upgrade to TS5, we can remove this function and just use the in operator instead. export function hasKey(k: K, o: T): o is T & Record { return k in o; }