I think a lot more is being made of this than it deserves. Here’s Rich Harris (Svelte creator) commenting on the last post about this that made it to the front page: https://news.ycombinator.com/item?id=35892250
> we are not abandoning type safety or anything daft like that — we're just moving type declarations from .ts files to .js files with JSDoc annotations.
> As a user of Svelte, this won't affect your ability to use TypeScript with Svelte at all — functions exported from Svelte will still have all the same benefits of TypeScript that you're used to
> Our commitment to TypeScript is stronger than ever
Unfortunately as far as I can tell that headline isn't really a very good summary of the situation, nor a generally accurate statement.
Svelte wanted to ditch the need for a build step in testing. Most library authors already tolerate having a build step for multiple reasons, and have no need to go this route. If your builds are too slow, you'd just use a fast compiler like esbuild and reserve the tsc pass for CI/tests and local IDE type checking. (There are still some advantages of not needing a build step, but IMO most people don't mind it as long as it's fast.)
If JS had a type syntax, this would be no issue at all. Unfortunately, who knows if that'll ever come to pass.
As far as I can tell the Svelte developers are not claiming at all that you should abandon typechecking, which is what a lot of people seem to be reading out of this.
I am a big advocate for typescript, but I'm sympathetic to the maintainer's concerns. I've had similar concerns about how I'm complicating people's build process by requiring a specific compiler. Not a huge deal for internal projects, but every org has their own idiosyncracies, and requiring typescript could become a huge pain point that leads them to drop svelte. JSDoc can work just as well without the headache, but I've found that text editors don't work as well with JSDoc type checking.
That happens every day in other languages. Lots of C++ projects require Visual Studio on Windows, sometimes certain other tools (e.g. https://winscp.net/forum/viewtopic.php?t=25209). Other projects expect you to use the official compiler, because almost nobody ever tried using a non official compiler with that project and how see how things would go. I don't know how it is a problem if TypeScript compiler is required (by itself).
I think we're talking about two different problems. You don't need to switch your whole project to typescript to use typescript, I'm just talking about the headache that comes from mixing something like vanilla js, webpack, closure compiler, and typescript. Vanilla js with JSDoc tends to play well with everything, so I think it's well suited for a library.
I didn’t read the article but after having used typescript for years i got sick of it and all my new projects just use regular js modules with jsdoc comments and I don’t mind it at all.
Unpopular opinion that might be due to being an old curmudgeon by tech standards:
TypeScript, the ES's and TC39s are a mistake since the beginning and ruined JavaScript. The root cause of all this is "JavaScript sucks and we want to build big complicated apps with it" and by "we" I mean big software teams working at big tech companies earning a small fortune every year.
If I have to write TypeScript, then I might just write Java or even C#, since it's a lousy copy of those languages. ( and yes, I say that very loosely ).
The modern ES[insert number] classes are weak and out of place and the module system is a complete joke and disaster. Truly! those people were either on drugs or are playing a joke on the "design by committee" phenomenon.
Yes, Javascript is not a great language, but it won not just because of distribution but also because it as made to be simple to pick up. Have any of these people watched a beginner and not-so beginner try to pick up "modern JavaScript" or TypeScript? Even Java looks like Basic in comparison!.
Thank God TypeScript and ES6 won over Dash/Dart from Google, but god damn it what an hollow victory.
As for myself, this old curmudgeon, I just stopped caring and ignored all of this frontend cesspool. Waiting/hoping all of this rots away.
Example project? what example project? np what? and then what?
I all this complication to show some clicky things on a web browser while inputting some data?
Why does your recommendation starts with "just download some other dudes code" to START a project?
These questions are obviously a means to make a point.
You can cross-compile Java and I'm not even defending Java, I used it as an example if we are going to suffer with this Rube Goldberg machine of mediocrity, then we might as well just program in Java, since it has the better tech and their package/import stuff is light years better than any TS or ES script and btw, it looks pretty much just like Java/C# now.
The JS people in charge completely lost the plot and given the nature of the industry, many software devs just started their careers with ES5/6/Typescript and don't even realize how ridiculous this whole thing is.
The problem was the misplaced "need" to make "Javascript" a "serious", best-of-breed ( ugh.. ) language to make big complicated web-apps. Given the premise and the context, of course we end with something like Typescript, which is as boring and mind numbing as Java.
How ironic it is to see the "hip" cool people at the time ending up with a mediocre copycat version of the Java world.. :)
> Example project? what example project? np what? and then what?
What do you want to do now? I thought setting up projects for beginners is too complicated. Now you expect them to bootstrap production environments. Which one is it?
> I all this complication to show some clicky things on a web browser while inputting some data?
You sound like a person who has no clue about frontend development. I know, because I used to speak the same way before going full-stack. It's not bad to not understand things, but I think it's bad to not understand things and have loud opinions about it.
If you seriously see no reason in using frontend technologies, you are free to pick whatever you like best. But then you act like you are smarter than a whole industry - which I doubt.
> just download some other dudes code
How is that different from using a library?
> package/import stuff is light years better than any TS or ES script
So your critizing the TS module system? I don't know. I don't have issues with that.
It's really hard to follow you as you are constantly topic-hopping. Would really help if you named some examples of why TS is so bad.
I can only tell you from my experience that having one language for frontend and backend reduces the amount of context switches as a dev and leads to a faster feedback cycle. Eventually, adding business value becomes easier and that is what it's all about. Not some weird culture wars about languages.
Some of us who were working on lots of Node/Deno projects had already moved on to ReScript, and I would be touting what a great step forward ReScript is away from TS and JS, but a team I am on agreed to attempt fullstack dev with Rust and htmx with very light use of ReScript for the frontend. Since then this has been our stack and one I go to for personal projects. One of our team members is looking to replace the remaining browser-side ReScript portion with Rust (WASM), so we will be pure Rust until we are ready to switch to Austral.
I avoid TypeScript because I already feel the tidal forces on me emanating from Redmond. We are currently working on an education app in C# and it’s simple and delightful to do it and our front end is so easy to do. I also kind of like Typescript too, but as the author here points out, then you’re married to this tooling and … all of these autogenerated files.
So for me I guess I’m saying the threshold is lower just because I already feel like I need to keep some diversity in our codebase.
I didn't downvote you despite the presumptive and condescending tone you took with my comment. Maybe that's why.
All I said was I don't want to use only Microsoft stuff on any one project, I never said (a) I didn't like TS or (b) other frameworks don't autogenerate other files.
/*
* Function that adds
* @param {number} a One number to add
* @param {number} b Another number to add
* @return {number} The added numbers
*/
function add(a, b) {
return a + b;
}
Ts syntax looks like this:
function add(a: number, b: number) {
return a + b;
}
You can use JS doc in TS as well, to document all the values. You just don’t put the types in :)
This headline is misleading to the point of being a lie, despite the body quoting the part explaining why it's misleading. Really bad. Author, OP, or Dang/mods should edit.
They're not changing away from TypeScript. They're changing from the TypeScript-style syntax for inline type annotations to the JSDoc-style syntax for type annotations in comments. They're still using TypeScript for type-checking, but now the source code can also run as-is. Dupe at <some URL>