Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions exercises/03.async/01.solution.await/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ This will allow me to await the `callback()` if it happens to be `async` too.

<CodeFile file="setup.ts" range="22-26" highlight="24" />

<callout-info>To let TypeScript know that `callback` is now, potentially, an asynchronous function, I will adjust its return type to include `Promise<void>`:</callout-info>

<CodeFile file="setup.ts" range="5-10" highlight="7" />

If I run the tests now, I can correctly see the assertion on `greetByResponse()` failing the relevant test:

```txt nocopy nonumber lines=3-4
Expand Down
2 changes: 1 addition & 1 deletion exercises/03.async/02.problem.rejections/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Assertions {

declare global {
var expect: (actual: unknown) => Assertions
var test: (title: string, callback: () => void) => void
var test: (title: string, callback: () => void | Promise<void>) => void
var beforeAll: (callback: () => void) => void
var afterAll: (callback: () => void) => void
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/03.async/02.solution.rejections/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Assertions {

declare global {
var expect: (actual: unknown) => Assertions
var test: (title: string, callback: () => void) => void
var test: (title: string, callback: () => void | Promise<void>) => void
var beforeAll: (callback: () => void) => void
var afterAll: (callback: () => void) => void
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/03.async/03.problem.waitFor/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Assertions {

declare global {
var expect: (actual: unknown) => Assertions
var test: (title: string, callback: () => void) => void
var test: (title: string, callback: () => void | Promise<void>) => void
var beforeAll: (callback: () => void) => void
var afterAll: (callback: () => void) => void
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/03.async/03.solution.waitFor/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Assertions {

declare global {
var expect: (actual: unknown) => Assertions
var test: (title: string, callback: () => void) => void
var test: (title: string, callback: () => void | Promise<void>) => void
var beforeAll: (callback: () => void) => void
var afterAll: (callback: () => void) => void
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/04.vitest/01.problem.using-vitest/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Assertions {

declare global {
var expect: (actual: unknown) => Assertions
var test: (title: string, callback: () => void) => void
var test: (title: string, callback: () => void | Promise<void>) => void
var beforeAll: (callback: () => void) => void
var afterAll: (callback: () => void) => void
}
Expand Down