Skip to content

Commit

Permalink
chore: fix ts checking on used-before-assigned (#6939)
Browse files Browse the repository at this point in the history
  • Loading branch information
zheeeng committed May 3, 2022
1 parent e96b908 commit 749e96f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions scripts/jestPerTestSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,15 @@ function startStaticServer(config?: InlineConfig): Promise<string> {
export async function notifyRebuildComplete(
watcher: RollupWatcher
): Promise<RollupWatcher> {
let callback: (event: RollupWatcherEvent) => void
await new Promise<void>((resolve, reject) => {
callback = (event) => {
if (event.code === 'END') {
resolve()
}
let resolveFn: undefined | (() => void)
const callback = (event: RollupWatcherEvent): void => {
if (event.code === 'END') {
resolveFn?.()
}
watcher.on('event', callback)
}
watcher.on('event', callback)
await new Promise<void>((resolve) => {
resolveFn = resolve
})
return watcher.removeListener('event', callback)
}
Expand Down

0 comments on commit 749e96f

Please sign in to comment.