Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

fix: bugged challenges (#952)

Tom Lienardf49605b65c69
diff --git a/challenges/indexed-types/tests.ts b/challenges/indexed-types/tests.ts
index 987a22d4..56ec81e9 100644
--- a/challenges/indexed-types/tests.ts
+++ b/challenges/indexed-types/tests.ts
@@ -17,6 +17,6 @@ type test_TheCoolestCarEverMade = Expect<Equal<
type test_TruckDriverBonusGiver = Expect<Equal<
TruckDriverBonusGiver,
- "Taylor Swift"
+ 45_000_000
>>;
diff --git a/challenges/literal-types/solutions/1.ts b/challenges/literal-types/solutions/1.ts
index 6f4775b5..ff27ab03 100644
--- a/challenges/literal-types/solutions/1.ts
+++ b/challenges/literal-types/solutions/1.ts
@@ -11,8 +11,8 @@ type LiteralFunction = (a: number, b: number) => number;
const literalString = 'Ziltoid the Omniscient';
const literalTrue = true;
const literalNumber = Math.random() > 0.5 ? 1 : 2;
-const almostPi = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019891337
-const literalObject = {
+const almostPi = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019891337;
+const literalObject = {
origin: "far across the omniverse",
command: "fetch",
item: "the universe's ultimate cup of coffee (black)",
diff --git a/challenges/mapped-object-types/tests.ts b/challenges/mapped-object-types/tests.ts
index f1605829..88555bf7 100644
--- a/challenges/mapped-object-types/tests.ts
+++ b/challenges/mapped-object-types/tests.ts
@@ -1,3 +1,5 @@
+import { Expect, Equal } from 'type-testing';
+
type MoviesByGenre = {
action: 'Die Hard';
comedy: 'Groundhog Day';
@@ -10,52 +12,53 @@ type MoviesByGenre = {
thriller: 'The Silence of the Lambs';
};
-type Example = MovieInfoByGenre<MoviesByGenre>;
-
-const example: Example = {
- action: {
- name: 'Die Hard',
- year: 1988,
- director: 'John McTiernan',
- },
- comedy: {
- name: 'Groundhog Day',
- year: 1993,
- director: 'Harold Ramis',
- },
- sciFi: {
- name: 'Blade Runner',
- year: 1982,
- director: 'Ridley Scott',
- },
- fantasy: {
- name: 'The Lord of the Rings: The Fellowship of the Ring',
- year: 2001,
- director: 'Peter Jackson',
- },
- drama: {
- name: 'The Shawshank Redemption',
- year: 1994,
- director: 'Frank Darabont',
+type test_MoviesInfoByGenre = Expect<Equal<
+ {
+ action: {
+ name: 'Die Hard',
+ year: 1988,
+ director: 'John McTiernan',
+ },
+ comedy: {
+ name: 'Groundhog Day',
+ year: 1993,
+ director: 'Harold Ramis',
+ },
+ sciFi: {
+ name: 'Blade Runner',
+ year: 1982,
+ director: 'Ridley Scott',
+ },
+ fantasy: {
+ name: 'The Lord of the Rings: The Fellowship of the Ring',
+ year: 2001,
+ director: 'Peter Jackson',
+ },
+ drama: {
+ name: 'The Shawshank Redemption',
+ year: 1994,
+ director: 'Frank Darabont',
+ },
+ horror: {
+ name: 'The Shining',
+ year: 1980,
+ director: 'Stanley Kubrick',
+ },
+ romance: {
+ name: 'Titanic',
+ year: 1997,
+ director: 'James Cameron',
+ },
+ animation: {
+ name: 'Toy Story',
+ year: 1995,
+ director: 'John Lasseter',
+ },
+ thriller: {
+ name: 'The Silence of the Lambs',
+ year: 1991,
+ director: 'Jonathan Demme',
+ },
},
- horror: {
- name: 'The Shining',
- year: 1980,
- director: 'Stanley Kubrick',
- },
- romance: {
- name: 'Titanic',
- year: 1997,
- director: 'James Cameron',
- },
- animation: {
- name: 'Toy Story',
- year: 1995,
- director: 'John Lasseter',
- },
- thriller: {
- name: 'The Silence of the Lambs',
- year: 1991,
- director: 'Jonathan Demme',
- },
-};
+ MovieInfoByGenre<MoviesByGenre>
+>>
diff --git a/challenges/primitive-data-types/tests.ts b/challenges/primitive-data-types/tests.ts
index 299794c6..99c21e3d 100644
--- a/challenges/primitive-data-types/tests.ts
+++ b/challenges/primitive-data-types/tests.ts
@@ -1,5 +1,5 @@
type test_age = Expect<NotLiteral<number, typeof age>>;
-type test_name = Expect<NotLiteral<string, typeof name>>;
+type test_artistName = Expect<NotLiteral<string, typeof artistName>>;
/** this is just a helper type to sus out literals */
type NotLiteral<T, U> =
diff --git a/challenges/primitive-data-types/user.ts b/challenges/primitive-data-types/user.ts
index 3774e70a..e2e7c4c8 100644
--- a/challenges/primitive-data-types/user.ts
+++ b/challenges/primitive-data-types/user.ts
@@ -5,7 +5,7 @@ const playSong = (
return `${name} was released in the year ${year}`;
};
-const name = 'Frank Zappa';
+const artistName = 'Frank Zappa';
const age = 52;
@@ -24,6 +24,6 @@ const musicianInfo = ({
};
musicianInfo({
- name,
+ name: artistName,
age,
-});
\ No newline at end of file
+});