flipper-common
Version:
Server & UI shared Flipper utilities
25 lines • 626 B
TypeScript
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
type Res<T> = {
promise: Promise<T>;
resolve: (...res: T extends void ? [] : [T]) => void;
reject: (reason: unknown) => void;
} & ({
state: 'pending';
promiseVal: undefined;
} | {
state: 'resolved';
promiseVal: T;
} | {
state: 'rejected';
promiseVal: unknown;
});
export declare const createControlledPromise: <T>() => Res<T>;
export {};
//# sourceMappingURL=controlledPromise.d.ts.map