Skip to content

Commit 68db7d4

Browse files
committed
Simplified 24
1 parent c801a67 commit 68db7d4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/05-function-overloads/24-function-overloads-vs-union-types.problem.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { expect, it } from "vitest";
22
import { Equal, Expect } from "../helpers/type-utils";
33

4-
function runGenerator(generator: unknown) {}
4+
function runGenerator(generator: unknown) {
5+
if (typeof generator === "function") {
6+
return generator();
7+
}
8+
return generator.run();
9+
}
510

611
it("Should accept an object where the generator is a function", () => {
712
const result = runGenerator({

0 commit comments

Comments
 (0)