Interfaces in TypeScript - with Taylor Swift
Interfaces in TypeScript - with Taylor Swift
I struggled this afternoon because a meeting was cancelled at short notice (or no notice) and that can throw me. So I am just trying to do what I set out to do - understand interfaces in TS. I am not meant to be doing TS stuff for now - if you know TS you know it gets complicated really fast and so I'm not trying to improve it for now - I am focusing on improving React. But I got told by someone I respect a lot to learn interfaces so I wanted to do this as a one off. But there are no good resources I can find
I asked Chat GPT to teach me about TypeScript through my favourite Taylor Swift songs. TS... TypeScript... TS... Taylor Swift. lol
An interface is the shape of an object. It's what it expects. Allow me to add this highly entertaining screenshot and sorry about the accessibility issues
I don't know what the hell is going on here but this is the most fun I've ever had in my life
What does it mean that public image here could be chaos OR mystery? hmm
AHHHH BRO THIS IS A UNION TYPE. This could be either
So it has to be one of those two strings.
And of course my all time favourite. A classic. Delicate
SHOWING HOW OPTIONAL PROPERTIES CAN BE ADDED TO AN INTERFACE
ZERO POINTS FOR ACCESSIBILITY OF COURSE
SORRY
I COULDN'T TYPE THIS ALL OUT
BRO
OPTIONAL PROPERTIES
So bro bro bro bro
These properties are OPTIONAL. So like here the trustIssues are optional and they have a question mark
If only trust issues could always be optional
*mic drop*
"You did a number on me but honestly baby who's counting..."
Cardigan
This is getting trippy now BRO
got it got it got it. Interfaces control what shapes look like. They remember the type of things. It's kind of like defining a class in Python - right?
BRO THIS JUST GOT DARK
SEVEN AND STRUCTURE
There is an overarching message. TypeScript interfaces don't care where the content comes from or what it does. They don't care whether the information is true or false. They just care if something is there if that makes sense - thanks. Great
Omg this is getting so cool beyond belief.
Extending interfaces
BRO BRO NOW WE ARE INTO SOMETHING - BRO BRO BRO BRO. BRO
Now I am finally really learning something from this
Okay bro I do not get this bro
Lets talk about extending interfaces
This is like python and extending classes. Okay bro
Bro.
I need a bit more example on this.
Okay okay more explanations needed please thanks:
Here are some more explanations in pictures, confirming everything that I thought I knew about extending interfaces
- So indeed I suspected `HoaxLove` includes everything from `Love`
- And then it adds some further requirements







Comments
Post a Comment