3 ms·
I completely agree. Learning new code without types is way slower for me. Example: you have a function that takes a 'file' parameter, and you need to modify th
by westoncb 10y ago
I completely agree. Learning new code without types is way slower for me.
Example: you have a function that takes a 'file' parameter, and you need to modify the function, so you need to know what the properties on the file object are. Is it some custom File class, or just a poor name choice, or the browser File interface?
In a statically typed language it would be marked explicitly and I could probably just CMD+click on it in my IDE and be done.
In, e.g., javascript what recourse do I have? No 'File' module is explicitly imported, and the function is invoked somewhere in library code so I never see the file object constructed. So, let's say it turns out to be this 'File': https://developer.mozilla.org/en-US/docs/Web/API/File https://developer.mozilla.org/en-US/docs/Web/API/File —how do I discover this? So far it's been time-wasting, unsystematic trial-and-error sorts of things.
It's not as big a deal as I thought when first switching to JS—but if you believe writing readable code is important, you're lose a major tool without being able to label types.