TypeScript is definitely an improvement over pure Javascript. However, you can still lie about the types and it still allows you to write nonsense (even in pure TS). > const x = 'xxxx' > if(x === undefined) { > console.log('never happens') > } will compile without any problems
How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
221–230 of 400 posts
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#222It's probably worth taking a step back and interrogating why the actual "Why was I Anti-TypeScript?" a little bit more and use it as an opportunity for broader self development. The author didn't use and understand something, and rather than trying to they instead just defaulted to rejection. It's midly disapointing seeing this in people who label themselves as "Senior".
As a "senior" I'm still not sold. Running across bugs in the type checking that blocked us for a while (trying to avoid Broken Windows to boot) and the fact our development times skyrocketed (including on personal projects) or that the answer to poor tooling was "just use VSCode" is not something that really screams "developer friendly".
One of the projects I worked on during my transition to typescript was to convert an existing project into it. Sure there was a lot of head banging against walls at some point to get the types to work out, but during that process I finally really understood how everything fit together and gained a sense of assurance that I could use a return of a function with complete confidence. Developing on that project afterwards was also a breeze, moving faster and more confidently knowing that the object types were set, and that guardrails were in place to prevent myself from shooting my own foot.
It's a new system to work within the guidelines of, but guardrails are there for a reason, to prevent you from falling off a cliff.
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#223Earlier quoted context omitted.
We only use TypeScript on frameworks that make it a requirement, the language is starting to look like Haskell. As much as I like Anders work, it is impossible to understand modern TypeScript without looking into tsconfig.json before looking into source code.
This does not align with my experience of writing Typescript at multiple companies of varying sizes and open source projects.
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#224Earlier quoted context omitted.
We only use TypeScript on frameworks that make it a requirement, the language is starting to look like Haskell. As much as I like Anders work, it is impossible to understand modern TypeScript without looking into tsconfig.json before looking into source code.
I don't understand what the tsconfig has to do with understanding the source? Maybe when using different path resolving or different tsconfigs to compile test files vs. production files? Many toolings make it so you don't even need to worry about the tsconfig anymore (though in reality it is very helpful to understand it).
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#225It's probably worth taking a step back and interrogating why the actual "Why was I Anti-TypeScript?" a little bit more and use it as an opportunity for broader self development. The author didn't use and understand something, and rather than trying to they instead just defaulted to rejection. It's midly disapointing seeing this in people who label themselves as "Senior".
I think moment when I really could call myself "senior developer" came when I realized annoying things I was struggling with are not stupid, it is just that I don't understand them very well.
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#226By removing type annotations you are going against automation. And, as a software developer, automation is your job.
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#227> I always felt that adding types to the functions/variables and satisfying the TypeScript compiler is an over-engineering and not providing any meaningful benefits. I honestly find this attitude horrifying. I'm glad the author was able to move on from this, but it is utterly pervasive in some parts of our industry. As far as "engineering" goes, specifying your types is about as low-hanging, basic a step as you can t…
JS the language isn't great but it's JS the culture that is the real problem. There is a subset of JS codebases that are good, well engineered and written by people that understand the languages faults and limitations but the list is incredibly small and even smaller still now Joyent isn't really around anymore. If there was one ecosystem I wish I never needed to touch again it would be JS but unfortunately it's beco…
Eventually, he bites a spoiled sandwich with mold and drinks spoiled milk.
That is the best analogy for npm.
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#228I have a love hate relationship with Typescript. I have come to see it as a tool and to use it when it makes sense and avoid it when it doesn't. I like the language at a conceptual level and find what it does very useful. The syntax I find less than desirable (especially nested generics). For smaller projects I tend to use just JS because it's faster if I just want to prototype an idea and I'm not planning on keeping…
I've seen this opinion before, and I don't understand it in the slightest.
Let's say you're modeling a "user". You might initially think that users should have a first & last name, so you write it this way. Then later on you realize that there's no point in this distinction, and some of your users from Indonesia don't even have separate first & last names, so you want to switch to a single name.
* With weak/no typing, you have search around for anything that matches the field names, and hope to God you didn't miss anything.
* With stronger typing you just change it let the compiler tell you all the places you need to fix up.
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#229Earlier quoted context omitted.
I mean, Coffeescript was fairly widely used at its peak, and now it's all but dead. Front-end fads are fickle. At least TypeScript has Microsoft backing it so they'll likely continue to support even if the rest of the webdev world moves on to the next shiny object.
I don't think I've ever heard of any in-production, large apps in Coffeescript, even from when it was at its peak. I know of a handful of companies that tried it and even enjoyed it quite a bit but none of it was for mass consumption. Typescript, meanwhile, is used for hugely popular apps, is used by very large companies, has Microsoft's full backing, etc. The two are not comparable. Edit: Clearly I'm misremembering…
Took over a year to convert to ES6.
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#230It's probably worth taking a step back and interrogating why the actual "Why was I Anti-TypeScript?" a little bit more and use it as an opportunity for broader self development. The author didn't use and understand something, and rather than trying to they instead just defaulted to rejection. It's midly disapointing seeing this in people who label themselves as "Senior".
Ironically, as someone who has experience w/ both fast-and-loose JS and with "properly" statically typed languages, my beef with typescript is precisely that it allows people to be fast and loose, sometimes in ways that are not super obvious. For example: type Thing = { name: string, }; function getThing(): Thing { return JSON.parse('{"error": "invalid id"}') } const thing: Thing = getThing(); // lie to me! console.l…
It will make it a lot harder to return wrong types from your calls. Personally, I like gRPC + Protobuf.