diff --git a/src/040-deriving-types-from-values/104-typeof-keyword.problem.ts b/src/040-deriving-types-from-values/104-typeof-keyword.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/104-typeof-keyword.solution.ts b/src/040-deriving-types-from-values/104-typeof-keyword.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/105-create-runtime-values-from-types.problem.ts b/src/040-deriving-types-from-values/105-create-runtime-values-from-types.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/105-create-runtime-values-from-types.solution.ts b/src/040-deriving-types-from-values/105-create-runtime-values-from-types.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/106-return-type.problem.ts b/src/040-deriving-types-from-values/106-return-type.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/106-return-type.solution.ts b/src/040-deriving-types-from-values/106-return-type.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/107-parameters-type-helper.problem.ts b/src/040-deriving-types-from-values/107-parameters-type-helper.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/107-parameters-type-helper.solution.ts b/src/040-deriving-types-from-values/107-parameters-type-helper.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/108-keyof.problem.ts b/src/040-deriving-types-from-values/108-keyof.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/108-keyof.solution.ts b/src/040-deriving-types-from-values/108-keyof.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/109-indexed-access-types.problem.ts b/src/040-deriving-types-from-values/109-indexed-access-types.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/109-indexed-access-types.solution.ts b/src/040-deriving-types-from-values/109-indexed-access-types.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/110-pass-unions-to-indexed-access-types.problem.ts b/src/040-deriving-types-from-values/110-pass-unions-to-indexed-access-types.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/110-pass-unions-to-indexed-access-types.solution.ts b/src/040-deriving-types-from-values/110-pass-unions-to-indexed-access-types.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/111-pass-keyof-into-an-indexed-access-type.problem.ts b/src/040-deriving-types-from-values/111-pass-keyof-into-an-indexed-access-type.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/111-pass-keyof-into-an-indexed-access-type.solution.ts b/src/040-deriving-types-from-values/111-pass-keyof-into-an-indexed-access-type.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/112-create-an-enum-from-as-const-object.problem.ts b/src/040-deriving-types-from-values/112-create-an-enum-from-as-const-object.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/112-create-an-enum-from-as-const-object.solution.ts b/src/040-deriving-types-from-values/112-create-an-enum-from-as-const-object.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/113-create-a-union-from-an-as-const-array.problem.ts b/src/040-deriving-types-from-values/113-create-a-union-from-an-as-const-array.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/113-create-a-union-from-an-as-const-array.solution.ts b/src/040-deriving-types-from-values/113-create-a-union-from-an-as-const-array.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/114-should-i-use-enums-or-as-const.problem.ts b/src/040-deriving-types-from-values/114-should-i-use-enums-or-as-const.problem.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/114-should-i-use-enums-or-as-const.solution.ts b/src/040-deriving-types-from-values/114-should-i-use-enums-or-as-const.solution.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/040-deriving-types-from-values/plan.md b/src/040-deriving-types-from-values/plan.md new file mode 100644 index 0000000..ddbb824 --- /dev/null +++ b/src/040-deriving-types-from-values/plan.md @@ -0,0 +1,34 @@ +# Title + +Deriving types from values + +## Exercises + +LEARNING GOAL: Understand the type world and the runtime world. +CONFUSION: Can I create runtime values from types? +LEARNING GOAL: Understand the `typeof` keyword. +CONFUSION: Is this the same as the JavaScript keyword? + +LEARNING GOAL: You can only create types from runtime values, not the other way around. + +LEARNING GOAL: Use `ReturnType` to get the return type of a function. +NOTEWORTHY: This is really good for extracting the return value of a third-party function. + +LEARNING GOAL: Use `Parameters` to get the parameters of a function. + +LEARNING GOAL: Understand the `keyof` keyword +CONFUSION: Why do we have to do `keyof typeof` instead of just `keyof`? + +LEARNING GOAL: Understand indexed access types +CONFUSION: Why can't I just use `.name` instead of `['name']`? + +LEARNING GOAL: Understand that you can pass unions into indexed access types. + +LEARNING GOAL: Understand that you can pass `keyof` into an indexed access type. + +LEARNING GOAL: Create an enum from an `as const` object. + +LEARNING GOAL: Create an enum from an `as const` array. +LEARNING GOAL: Understand the `T[number]` syntax. + +CONFUSION: Should I use enums, or 'as const' objects?