Skip to content

Commit

Permalink
fix(wait.reject): 将返回结果的类型设为 never
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Jan 25, 2022
1 parent d4e9dd9 commit 5ef338a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/wait.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ export function wait<T>(milliseconds: number, value?: T): WaitResult<T> {
wait.reject = function reject(
milliseconds: number,
value?: any,
): WaitResult<void> {
): WaitResult<never> {
const waitRes = wait(milliseconds)
const res: WaitResult<void> = waitRes.then(() => Promise.reject(value)) as any
const res: WaitResult<never> = waitRes.then(() =>
Promise.reject(value),
) as any
res.cancel = waitRes.cancel
return res
}

0 comments on commit 5ef338a

Please sign in to comment.