mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-25 11:17:50 +01:00
434e379f9a
git-subtree-dir: plugin-server git-subtree-mainline:776b056b6d
git-subtree-split:01a99a4e26
16 lines
402 B
TypeScript
16 lines
402 B
TypeScript
interface MockPromise<T> {
|
|
promise: Promise<T>
|
|
resolve: (value?: any) => void
|
|
reject: (error: any) => void
|
|
}
|
|
|
|
export function createPromise<T = void>(): MockPromise<T> {
|
|
const result: Partial<MockPromise<T>> = {}
|
|
result.promise = new Promise<T>((_resolve, _reject) => {
|
|
result.resolve = _resolve
|
|
result.reject = _reject
|
|
})
|
|
|
|
return result as MockPromise<T>
|
|
}
|