if you write javascript or python code the code completion is statistics, since the IDE does not know what methods exist.
With typing you IDE can determine what functions exist and only suggest actually existing methods.
If you have small projects and work alone you know which methods exist, if you have a big project or multiple people working on it, it's impossible to know what is available and you end up always checking the implementation (If you can find it)
It depends on the situation and there are many viable solutions. You could use interfaces as example.
Like, if you have a calendar and multiple different types of events that go on a calendar and need some type of function that based on their own unique definition tells you what time it will be and a description of what the event is.
You can make an interface InteractsWithCalendar, or what have you. The interface demands: if you're implementing me, you must follow my contract. The contract could state that you must define a getCalendarDefinition function.
Then, on the different classes that interact with a calendar, you declare they implement the interface, and you give each class their own respective getCalendarDefinition implementation.
Now, if I want to build my calendar, I could define my variables as an array of type InteractsWithCalendar. Now, I know for sure my objects all implement the getCalendarDefinitio function, and I can call that without worries.
View all comments
1
u/DarthCloakedGuy Sep 25 '26
I tried it... still not sure what the benefit is, and for some things it is very much not wanted