56 points · by pg_1234 · 3y ago · 26 comments
> 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
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.
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).
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.
You might just write it in an object-oriented way... but OOP sucks.
> Have any of these people watched a beginner and not-so beginner try to pick up "modern JavaScript" or TypeScript?
What are you talking about?
Don't know how beginners would feel about writing gradle tasks though. Don't know if they can cross-compile Java to the browser as well.
https://rescript-lang.org/ https://animaomnium.github.io/what-austral-proves/
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.
/*
* 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 :)Dupe of https://news.ycombinator.com/item?id=35892250
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>