Skip to content

Commit 328d4b8

Browse files
committed
Fixed 06-index-signatures
1 parent 32437f8 commit 328d4b8

File tree

4 files changed

+41
-36
lines changed

4 files changed

+41
-36
lines changed

package-lock.json

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+20-22
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"cross-fetch": "^3.1.5",
1111
"jsdom": "^21.1.1",
1212
"prettier": "^2.8.7",
13-
"typescript": "^5.4.5",
13+
"typescript": "5.4.5",
1414
"vite-tsconfig-paths": "^4.0.7",
1515
"vitest": "^1.6.0"
1616
},
@@ -22,6 +22,10 @@
2222
"ci": "(cd scripts/tests && npx vitest run)",
2323
"prepare": "tt-cli prepare-stackblitz",
2424
"update-snapshots": "(cd scripts/tests && npx vitest run -u)",
25+
"e-00": "tt-cli run 00",
26+
"s-00": "tt-cli run 00 --solution",
27+
"e-01": "tt-cli run 01",
28+
"s-01": "tt-cli run 01 --solution",
2529
"e-02": "tt-cli run 02",
2630
"s-02": "tt-cli run 02 --solution",
2731
"e-03": "tt-cli run 03",
@@ -58,18 +62,32 @@
5862
"s-18": "tt-cli run 18 --solution",
5963
"e-18.2": "tt-cli run 18.2",
6064
"s-18.2": "tt-cli run 18.2 --solution",
65+
"e-19.3": "tt-cli run 19.3",
66+
"s-19.3": "tt-cli run 19.3 --solution",
67+
"e-19.4": "tt-cli run 19.4",
68+
"s-19.4": "tt-cli run 19.4 --solution",
6169
"e-20": "tt-cli run 20",
6270
"s-20": "tt-cli run 20 --solution",
6371
"e-21": "tt-cli run 21",
6472
"s-21": "tt-cli run 21 --solution",
6573
"e-22": "tt-cli run 22",
6674
"s-22": "tt-cli run 22 --solution",
75+
"e-22.5": "tt-cli run 22.5",
76+
"s-22.5": "tt-cli run 22.5 --solution",
77+
"e-22.9": "tt-cli run 22.9",
78+
"s-22.9": "tt-cli run 22.9 --solution",
6779
"e-23": "tt-cli run 23",
6880
"s-23": "tt-cli run 23 --solution",
81+
"e-23.9": "tt-cli run 23.9",
82+
"s-23.9": "tt-cli run 23.9 --solution",
6983
"e-24": "tt-cli run 24",
7084
"s-24": "tt-cli run 24 --solution",
85+
"e-24.9": "tt-cli run 24.9",
86+
"s-24.9": "tt-cli run 24.9 --solution",
7187
"e-25": "tt-cli run 25",
7288
"s-25": "tt-cli run 25 --solution",
89+
"e-25.9": "tt-cli run 25.9",
90+
"s-25.9": "tt-cli run 25.9 --solution",
7391
"e-26": "tt-cli run 26",
7492
"s-26": "tt-cli run 26 --solution",
7593
"e-26.5": "tt-cli run 26.5",
@@ -93,27 +111,7 @@
93111
"e-34": "tt-cli run 34",
94112
"s-34": "tt-cli run 34 --solution",
95113
"e-38": "tt-cli run 38",
96-
"s-38": "tt-cli run 38 --solution",
97-
"e-00": "tt-cli run 00",
98-
"s-00": "tt-cli run 00 --solution",
99-
"e-01": "tt-cli run 01",
100-
"s-01": "tt-cli run 01 --solution",
101-
"e-22.9": "tt-cli run 22.9",
102-
"s-22.9": "tt-cli run 22.9 --solution",
103-
"e-23.9": "tt-cli run 23.9",
104-
"s-23.9": "tt-cli run 23.9 --solution",
105-
"e-24.9": "tt-cli run 24.9",
106-
"s-24.9": "tt-cli run 24.9 --solution",
107-
"e-25.9": "tt-cli run 25.9",
108-
"s-25.9": "tt-cli run 25.9 --solution",
109-
"e-19.3": "tt-cli run 19.3",
110-
"s-19.3": "tt-cli run 19.3 --solution",
111-
"e-19.4": "tt-cli run 19.4",
112-
"s-19.4": "tt-cli run 19.4 --solution",
113-
"e-22.5": "tt-cli run 22.5",
114-
"s-22.5": "tt-cli run 22.5 --solution",
115-
"e-30.6": "tt-cli run 30.6",
116-
"s-30.6": "tt-cli run 30.6 --solution"
114+
"s-38": "tt-cli run 38 --solution"
117115
},
118116
"dependencies": {
119117
"@types/express": "^4.17.14",

src/01-branded-types/06-index-signatures.problem.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,17 @@ it("Should let you add users and posts to the db by their id", () => {
3838
name: "Miles",
3939
};
4040

41-
const post = db[postId];
42-
const user = db[userId];
41+
const test = () => {
42+
// Code slightly updated since video was recorded, see
43+
// https://gist.github.com/mattpocock/ac5bc4eabcb95c05d5d106ccb73c84cc
44+
const post = db[postId];
45+
const user = db[userId];
4346

44-
type tests = [
45-
Expect<Equal<typeof post, Post>>,
46-
Expect<Equal<typeof user, User>>,
47-
];
47+
type tests = [
48+
Expect<Equal<typeof post, Post>>,
49+
Expect<Equal<typeof user, User>>,
50+
];
51+
};
4852
});
4953

5054
it("Should fail if you try to add a user under a post id", () => {

src/01-branded-types/06-index-signatures.solution.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ it("Should let you add users and posts to the db by their id", () => {
3434
name: "Miles",
3535
};
3636

37-
const post = db[postId];
38-
const user = db[userId];
39-
40-
type tests = [
41-
Expect<Equal<typeof post, Post>>,
42-
Expect<Equal<typeof user, User>>,
43-
];
37+
const test = () => {
38+
const post = db[postId];
39+
const user = db[userId];
40+
41+
type tests = [
42+
Expect<Equal<typeof post, Post>>,
43+
Expect<Equal<typeof user, User>>,
44+
];
45+
};
4446
});
4547

4648
it("Should fail if you try to add a user under a post id", () => {

0 commit comments

Comments
 (0)