3 ms·
Many many moons ago I wrote C and C++, typed languages right? I don’t remember typing my code being so abstract and complicated. Take php 7+, has good typing f
by AltruisticGapHN 6y ago
Many many moons ago I wrote C and C++, typed languages right? I don’t remember typing my code being so abstract and complicated.
Take php 7+, has good typing features and is way, way easier to understand.
All I want is native js interfaces, namespaces and basic types, then F### typescript :)
Seriously somtimes as nerds we like something because its complicated and presses our dopamine buttons when we figure it out, but then what is the practical outcome?
Problem is there seems to be no middle point? I can’t write vanilla js now on new project, typing structures like json messages is bare minimum.
The problem with Ts is even if you don’t want to use it "like an expert" there is no beginner use, you will very quickly run into complicated abstractions and all kind of typescript errors due to fluidity of js language.
So I think native js typings is our only hope but when you see how crappy some vanilla js syntax is, what they did with classes, I’m not holding my hopes up.
- nathias 6y agoFor me it would make sense for it to be a plugin for your IDE, not a language, and now its something in-between. This trend also goes against the development and adoption of writing with languages that have actual types and their ecosystems.
- machiaweliczny 6y agoThere's middle ground with TS. Just allow implicit any and use JSDoc.
- AltruisticGapHN 6y agoI tried JSDoc. I liked it at first but soon it became unusable. Even putting aside how verbose it is, the problem is the IDE support was not working. Trying to document eg. Vue props with JSDoc, there was no completion. Seems to me JSDoc in VSCode was working great for vanilla JS, but as soon as you use Vue, there are so many completions that were not recognised that it defeats the purpose. I mean, the IDE autocomplete where the IDE knows what members are in a given object, makes the work of typing the code all worth it. If it works only half the time, then it becomes pointless. TypeScript is ok, but as soon as you have to do like DOM manipulation, then you get into the rabbit hole :) Figuring out all the ways those DOM apis are dclared, why they have many signatures sometimes for the same function... Then again I suppose that's how you really learn TS. Like if you wanted to declare an array with a default value in a Vue prop with JSDoc: props: { items: { /\* @type {{ new(): string[] }} \*/ type: Array, default: function() { return [] } It took some time to figure out how to do it with JSDoc (eg. above you can't use arrow function to declare the default value. Then you need to figure all kind of shenanigans with Vetur/eslint... just wasn't worth the hassle, may as well use TS.
- franklyt 6y agoYour problem might be that VSC is not an “IDE”, so you’re only going to get the support you ask out of it. Webstorm might suit you better.
- franklyt 6y agoTs-check + JSDoc feels great.