0:30 I don't understand what you mean with 'give me the keys that are typeof number' here. The type is a union of strings. Sure, treated as an array, they each have an index, but how is number relevant for the CourseCode type? That part went a little too fast for me :)
i'll tell you what i understood so, courses is an array, you can access it via number indexes, ok. "courses[number]" is telling the typescript compile the following: Look, I know "courses" is an array of these specific values (because its readonly), so, get me the values I'd get if i were to access it using a number and then it returns all the values in a union, because if you were to put a number in "courses[number]", like 0, "courses[0]", it would give you that value so, "courses[number" would be all the values in a union because the number is not defined im sorry, i explain things very badly
0:30 I don't understand what you mean with 'give me the keys that are typeof number' here. The type is a union of strings. Sure, treated as an array, they each have an index, but how is number relevant for the CourseCode type?
That part went a little too fast for me :)
i'll tell you what i understood
so, courses is an array, you can access it via number indexes, ok.
"courses[number]" is telling the typescript compile the following:
Look, I know "courses" is an array of these specific values (because its readonly), so, get me the values I'd get if i were to access it using a number
and then it returns all the values in a union, because if you were to put a number in "courses[number]", like 0, "courses[0]", it would give you that value so, "courses[number" would be all the values in a union because the number is not defined
im sorry, i explain things very badly
Great tips! Is the full TS course out yet?
Awesome, thank you
@WesBos When is your new course on Typescript is going to roll out?
Soon!
What (like-handwritten) font do you use for names?
Operator mono!
Can you tell us what is your theme name??
Cobalt2