-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba19cd3
commit 7ed6826
Showing
23 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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? |