LEARNING JOURNAL

I created this learning journal to practice writting and to help me learn by writting everything down. Source code here

1/2/2024[edited at: 1/12/2024]

The difference between SATISFIES and AS

The difference between myColor and myColor2 is that myColor's type is ColorWithId, which means myColor.color can be either "red", "green", or "blue", we don't know. However, myColor2's type is a certain type that satisfies ColorWithId, which means myColor2.color can only be "red". The type of myColor2 is actually defined when we assign the object of {id: 1, color: 'red'} to it and this object happens to satisfy ColorWithId (otherwise, VSCode will scream at us).