Earlier quoted context omitted.
Can be said about regular modern JS as well. Whether your project has types or not is not alone going to determine the success of the project.
I personally can’t agree with that. TS catches me writing numerous bugs a day, the structural typing plus static analysis is a superb combination. If your code base is in JS without types, you probably have many bugs, you just don’t know about them. Especially around undefined/null handling. TypeScript also allows me to refactor fearlessly, which substantially improves the quality of my code as I can do mini-rewrites…
TypeScript is now officially 10 years old
71–80 of 207 posts
Re: TypeScript is now officially 10 years old
#72Earlier quoted context omitted.
TS is emphatically not a superset of JS. It rejects perfectly valid JS leaving you no recourse other than design your whole architecture around what TypeScript allows. Which is what Microsoft wants of course.
That’s not true. You can import JS directly into TS or use ts-ignore annotations.
Re: TypeScript is now officially 10 years old
#73Re: TypeScript is now officially 10 years old
#74Earlier quoted context omitted.
That unfortunately hasn’t helped C# become more popular outside of Microsoft legacy shops even when it did go cross platform and open source.
C# and ASP.NET Core feels like the default stack in Western Europe, even among startups. You have to look harder to find companies using Node.js, Rails, Django etc.
https://news.ycombinator.com/item?id=33140210
The “startups” in the US are even bimodal. You have the ones that set up shop outside of the west coast in big cities that hire “enterprise devs” and you have the well funded ones that try to compete with big tech salary compensation.
Re: TypeScript is now officially 10 years old
#75The post mentions one of the most important factors in TypeScript’s adoption: it launched, from the start, with good tooling.
Microsoft always had great tooling
"go to definition" -> goes to type definition
Microsoft makes it intentionally impossible to get anything done in their ecosystem without having "great tooling".
Re: TypeScript is now officially 10 years old
#76Earlier quoted context omitted.
That unfortunately hasn’t helped C# become more popular outside of Microsoft legacy shops even when it did go cross platform and open source.
Well the fact that it was available solely on Windows for so long was its doom. Actually I thought of using C# a few months ago, and I was like "Oh wait, does it even work on other platforms than Windows now?". Sure I'm not a C# developer, so I'm not up to date on C# news, but that's an issue if your goal is to drive adoption. Everyone that has heard of C# should know that it's now cross-platform.
Re: TypeScript is now officially 10 years old
#77Typescript was my stepping stone into the world of Rust. Even before Deno made it easy, it was straightforward enough to configure a simple tsconfig and just run tsc. Much like cargo, there is a lot to be said for "it just works" tooling - especially for beginners or even new programmers. It is probably fair to say it is one of the most influential and impactful languages of all time. There's even the future possibil…
> There's even the future possibility of much of its type syntax being absorbed back into JavaScript: https://github.com/tc39/proposal-type-annotations ... as comments. Which superficially resemble the syntax of type hints but do nothing. Which has to be one of the worst language design decisions of all time.
Typescript has been doing a fantastic job, and this proposal is continuing in that same vein, truly absorbing as much of that as possible back into JS!
Kudos to everyone involved, great effort!
And re "[the type hints] do nothing": The section at the end of the proposal clearly explains why that must necessarily be the case: Evolutions of JS must not break the web (especially) for the users.
Quoting: "TypeScript's model -- which has been highly successful for JS developers -- is around non-local, best-effort checks. (...) Additionally, defining a type system to run directly in the browser means that improved type analyses would become breaking changes for the users of JavaScript applications, rather than for developers. This would violate goals around web compatibility (i.e. "don't break the web"), so type system innovation would become near-impossible. Allowing other type systems to analyze code separately provides developers with choice, innovation, and freedom for developers to opt-out of checking at any time."
So this proposal provides the best possible path forward for JS, based on what folks are voting for with their feet by using TS: Making JS compatible with TS-style type hints that can be used by external tools (i.e. not the JS engines executing the code at runtime) to validate the code in a best-effort manner while the developer is looking at it, while not changing JS runtime semantics and thus never breaking the code while the user is running it.
Re: TypeScript is now officially 10 years old
#78Earlier quoted context omitted.
> Typescript is for big project and team collaboration. TypeScript is for any kind of project, it just makes your code safer, easier to debug, easier to read / come back to in the future, etc. > Fast! That doesn't mean anything. Especially for a small project, the TypeScript to JavaScript compilation will take milliseconds, there is no speed impact at all.
My project is small but TS takes 4-5 seconds to compile it from scratch on each run. The main speed impact is in developer productivity though. If something ain't working right, now I first gotta fix the types before I can see if I've fixed the actual logic. I imagine if my codebase was more "OOP-y" (i.e. if I replaced every layer of my domain model with 3 layers of dependency injection, turning the whole thing into…
A perfect scenario for me is having all errors in the project caught by vscode. At the moment vscode only checks files that are currently open. I think type checking should only be done when building to some sort of production or realtime in your editor. Templates like "create react app" can report runtime errors but it's somewhat strange that it also report typescript errors. (although understandable given that it wants to be tooling agnostic)
One potential major upside with adding optional type hints to javascript is the ability to run typescript files directly in the browser without needing to strip types in a build step. Advanced type checking could be done the same way we use linters like eslint.
Re: TypeScript is now officially 10 years old
#79Wanted to try it, proceeded to install it with npm and it was incredibly scary, both the amount of stuff it pulled in and various warnings. No thanks, I'll stay with languages with more self-contained compiler.
I don't understand what you are referring to - the TypeScript compiler has 0 (non-dev) dependencies: https://github.com/microsoft/TypeScript/blob/main/package.js... .
Re: TypeScript is now officially 10 years old
#80I was unsure of Typescript at first, but it has become an absolute joy and absolute pleasure to develop in. I was reluctant to introduce a build step (having got used to the simple refresh cycle of a browser plus vanilla javascript) but I am pleased to say that this is a bit of a non-issue now with modern tooling like esbuild et al. I still avoid NPM like the absolute plague, but the good news is that tooling like De…
Can be said about regular modern JS as well. Whether your project has types or not is not alone going to determine the success of the project.