You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your task is to add a type annotation to the `acceptAnythingExceptNullOrUndefined` function that will allow it to accept any value except `null` or `undefined`.
1018
1015
1019
-
<Exercisetitle="Exercise 1: Accept Anything Except `null` and `undefined`"filePath="/src/050-the-weird-parts/150-empty-object-type.problem.ts"></Exercise>
1016
+
<Exercisetitle="Exercise 1: Accept Anything Except `null` and `undefined`"filePath="/src/050-the-weird-parts/150-empty-object-type.problem.ts"resourceId="NMpTvrI4rUCyVa4GW2ViSR"></Exercise>
1020
1017
1021
1018
### Exercise 2: Detecting Excess Properties in an Object
1022
1019
@@ -1056,7 +1053,7 @@ myFetch(options);
1056
1053
1057
1054
Your challenge is to determine why the `@ts-expect-error` directive isn't working, and restructure the code so that it does. Try to solve it multiple ways!
1058
1055
1059
-
<Exercisetitle="Exercise 2: Detecting Excess Properties in an Object"filePath="/src/050-the-weird-parts/152-excess-properties-warnings.problem.ts"></Exercise>
1056
+
<Exercisetitle="Exercise 2: Detecting Excess Properties in an Object"filePath="/src/050-the-weird-parts/152-excess-properties-warnings.problem.ts"resourceId="PUZfccUL9g0ocvr45qbRoQ"></Exercise>
1060
1057
1061
1058
### Exercise 3: Detecting Excess Properties in a Function
1062
1059
@@ -1111,7 +1108,7 @@ Despite TypeScript not expecting an `age` on `User`, it doesn't show an error, a
1111
1108
1112
1109
Your task is to determine why TypeScript isn't raising an error in this case, and find two different solutions to make it error appropriately when an unexpected property is added.
1113
1110
1114
-
<Exercisetitle="Exercise 3: Detecting Excess Properties in a Function"filePath="/src/050-the-weird-parts/153-excess-properties-warnings-in-functions.problem.ts"></Exercise>
1111
+
<Exercisetitle="Exercise 3: Detecting Excess Properties in a Function"filePath="/src/050-the-weird-parts/153-excess-properties-warnings-in-functions.problem.ts"resourceId="PUZfccUL9g0ocvr45qbS8Y"></Exercise>
1115
1112
1116
1113
### Exercise 4: Iterating over Objects
1117
1114
@@ -1150,7 +1147,7 @@ Try to solve this exercise with a `for` loop for one solution, and `Object.keys(
1150
1147
1151
1148
Remember, `Object.keys()` is typed to always return an array of strings.
1152
1149
1153
-
<Exercisetitle="Exercise 4: Iterating over Objects"filePath="/src/050-the-weird-parts/154.6-iterating-over-objects.problem.ts"></Exercise>
1150
+
<Exercisetitle="Exercise 4: Iterating over Objects"filePath="/src/050-the-weird-parts/154.6-iterating-over-objects.problem.ts"resourceId="PUZfccUL9g0ocvr45qbSW2"></Exercise>
// red squiggly line under event, x, y, and screenId
1229
1224
typetests= [
1230
1225
Expect<Equal<typeofevent, Event>>,
1231
1226
Expect<Equal<typeofx, number>>,
@@ -1239,7 +1234,7 @@ In almost every case, TypeScript is giving us errors.
1239
1234
1240
1235
Your task is to update the `CallbackType` to ensure that it can handle all of these cases.
1241
1236
1242
-
<Exercisetitle="Exercise 5: Function Parameter Comparisons"filePath="/src/050-the-weird-parts/155-function-parameter-comparisons.problem.ts"></Exercise>
1237
+
<Exercisetitle="Exercise 5: Function Parameter Comparisons"filePath="/src/050-the-weird-parts/155-function-parameter-comparisons.problem.ts"resourceId="jUJqrXCHRph0Z4Fs6VxI9r"></Exercise>
1243
1238
1244
1239
### Exercise 6: Unions of Functions with Object Params
Your task is to determine how to type the `obj` parameter to the `logAll` function. Look closely at the type signatures for the individual logger functions to understand what type this object should be.
1284
1278
1285
-
<Exercisetitle="Exercise 6: Unions of Functions with Object Params"filePath="/src/050-the-weird-parts/156-unions-of-functions-with-object-params.problem.ts"></Exercise>
1279
+
<Exercisetitle="Exercise 6: Unions of Functions with Object Params"filePath="/src/050-the-weird-parts/156-unions-of-functions-with-object-params.problem.ts"resourceId="NMpTvrI4rUCyVa4GW2ViZX"></Exercise>
1286
1280
1287
1281
### Exercise 7: Union of Functions With Incompatible Parameters
1288
1282
@@ -1334,7 +1328,7 @@ Currently there's an error on `input` in the return statement of the `format` fu
1334
1328
1335
1329
A useful tidbit - `any` is not assignable to `never`.
1336
1330
1337
-
<Exercisetitle="Exercise 7: Union of Functions With Incompatible Parameters"filePath="/src/050-the-weird-parts/157-unions-of-functions.problem.ts"></Exercise>
1331
+
<Exercisetitle="Exercise 7: Union of Functions With Incompatible Parameters"filePath="/src/050-the-weird-parts/157-unions-of-functions.problem.ts"resourceId="Mcr8ILwjCSlKdfKEBg8upM"></Exercise>
1338
1332
1339
1333
### Solution 1: Accept Anything Except `null` and `undefined`
0 commit comments