Skip to content

Commit 4bf708c

Browse files
fix: override # private unions in Horror Factory (#277)
1 parent 1d15e90 commit 4bf708c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

projects/classes/horror-factory/src/index.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import * as index from "./index";
44
import * as solution from "./solution";
55

66
const { createDemon, createSorcerer, Horror } = process.env.TEST_SOLUTIONS
7-
? solution
7+
? // TypeScript treats # privates as unique, even across two otherwise identical classes.
8+
// This assertion "tricks" the type system into treating both Horror classes the same.
9+
// https://github.com/LearningTypeScript/projects/issues/276
10+
(solution as typeof index & typeof solution)
811
: index;
912

1013
const createMockHorrorSettings = (evil: boolean) => {

0 commit comments

Comments
 (0)