Live data from Hacker News

TypeScript is now officially 10 years old

coderoasis.com

71–80 of 207 posts

Re: TypeScript is now officially 10 years old

#71
post #48

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…

Nothing as satisfying as quickly adjusting all the red squiggly lines after a big refactor and then seeing everything run perfectly again.

Re: TypeScript is now officially 10 years old

#72
post #67

Earlier 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.

No post body was provided.

Re: TypeScript is now officially 10 years old

#73
post #6
post #2

The post mentions one of the most important factors in TypeScript’s adoption: it launched, from the start, with good tooling.

Incremental adoption and syntax close to JS

>Incremental adoption

i.e. "it stays out of your way if you don't actually try to use it"

Re: TypeScript is now officially 10 years old

#74
post #25

Earlier 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.

See my previous post about the bimodal nature of tech salaries in the US.

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

#75
post #2

The 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

> 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

#76

Earlier 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.

Some things still seem to be Windows specific. If I want offline documentation (of the sort one can find at /usr/share/javadoc/java or /usr/share/doc/rust/html by installing the correct packages), every place I look tell me how to enable offline help in Visual Studio (for instance, https://learn.microsoft.com/en-us/teamblog/offline-book-refr...). Someone here told me last time that there's a way to download whole sections of the MSDN documentation as PDF, which helps, but it's not the same thing.

Re: TypeScript is now officially 10 years old

#77
post #40
post #37

Typescript 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.

I just want to note that it seems incorrect to call this a superficial resemblance in terms of syntax. I went and read through the whole thing, and the syntax for the type hints seems to be as close to 100% TypeScript as possible, which is to say, it is very close. There may be some features missing that TS supports, but the bulk of it is there, and what's there is basically Typescript, which is the best thing that could possibly be accomplished here.

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

#78

Earlier 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…

For me the best experience during development is to build ts to js first with something fast like esbuild and check types in parallel without preventing the output in any way from running in the browser.

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

#79
post #14

Wanted 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... .

Yes, it also comes delivered as several near-identical builds for different contexts, each of which is nearly non-extensible. Have you seen the kind of monkey patching Volar (Vue tooling) does to enable type checking of TypeScript embedded in Vue templates? Meanwhile, native JSX support lol

Re: TypeScript is now officially 10 years old

#80
post #48

I 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.

I've written some projects w really complicated data and I personally think it would take 5x as long or push me to almost give up if I didn't have type checking.
Post reply on HN