Not really. I think you should welcome such ideas. After all, TS was introduced and adopted... so why can't it be the other way around? Isn't that how tech works.
I'm with you there. There is many other languages we need to get rid of. But before them; let us start here with type script.
What if JS could do Types??? Maybe that is what should happen.
BTW- I see you do React. Do you do any JS?
Or any other languages and did you just start with React if you do other languages ?
Just curious because I'm a JS aficionado.
Javascript with types... is basically Typescript. But should the browser parse the types? What about the overhead of doing that? Or will we require a build step to strip out the types to have smaller files? Isn't that just Typescript again?
yeah and then I don't have to learn type-script. I would only learn JavaScript which has type script. i think. we have to concat all these languages if we are to put our energies and knowledged together in one place to reach alien technology knowledgy!!!!
true ....if and only if ...and there is relativity to the subject matter ....There is learning something completely different but then there is learning something that is a knock off and unnecessary. The industry is not gonna go anywhere anytime soon.
Unnecessary? Why? I lerned Elixir and it changed my approach to Javascript. So, learning other styles changes the way you think. Also whatever the type hints in JS will look like, they will take notes from Typescript. There are only so many ways to go about implementing types. Learn the fundamentals, the rest is just syntax. So, when you believe types in Javascript will not require you to learn additional things you'd be very disappointed.
You can already (partially) do this in VS Code with the Deno extension (and probably other TS-related extensions) — just add // @ts-check at the top of your JS file. Then you can use "Infer types from usage" to get JSDoc type annotations. It won't be able to infer everything, but works well enough for many everyday use cases.
You can also do the same thing in TS files (except the annotations will be TS ones rather than JSDoc, and you don't need to use // @ts-check).
As I say, it works with TypeScript just as well as with JSDoc. Personally I usually go with TS, but depends on your personal preference and the needs of your project as to which you choose. I'm just responding to the idea that text editors/IDEs can never infer types from usage, which is wrong.
I think typescript aren't merely for the sake of type-safety, but rather, a beacon for code comprehension. Types contribute in conveying the author's original intentions, making it easier for future readers to understand the code and for maintainers to make safe changes.
Depends. If you use JSDoc, sure the hints provided by it are enough to typecheck and autocomplete, as long as you use it everywhere where the JS alone is not enough to infer the types.
If you don't use JSDoc or any other way to declare static types, a substantial part of your codebase won't be possible to be statically typechecked and therefore you won't get coding assistance.
No ... it's powerful, and it definitely has its place on more complex projects. Not saying it should be used on every project, but I'm using it on a project now and I definitely feel it has benefits there.
A good enough linter (which is just the first part of a compiler) can infer types and auto assign them. Then tell you when a type is being misused. But, I haven't seen a linter that is that good yet. Sad, since there are compilers for some languages with they type of ability. I believe the real issue is that linters are designed to be fast to process the code as you type. But, doing that much checking would make them too slow.
You are wrong. No the editors can never be smart enough without types and that's the biggest reason we need types. Is there a ton of shit in typescript: yes, should we get rid of it: no.
A programming language is a tool like any other. If you don’t like it or it doesn’t fit your use case then don’t use it. But why campaign for eliminating it altogether?
What’s the point of taking away a tool from others because you don’t like it?
Also how is the editor supposed to help with types of the programmer doesn’t tell them what the types are? Where does the ‘intelligence’ come from?
You still need some type system... including generics and stuff. JSDoc can do that and has benefits especially for library development (no build step). But JSDoc is more tedious to write. So there are trade offs to consider. Also, in any case, you wont get runtime type safety anyways, in contrast to other languages like Rust...
IDEs and editors use Typescript tooling to do the type checking and autocomplete. So, you are wrong! Also the idea of relying on an IDE to compile your code sounds absurd to me!
We should get rid of idea of getting rid of TS.
Not really. I think you should welcome such ideas. After all, TS was introduced and adopted... so why can't it be the other way around? Isn't that how tech works.
I don't want to. I like TS and studied it not for nothing, you know. Tech works how vendors want it to work - i mean Google, Apple, Microsoft and etc.
Valid. And that's okay. But stopping others is wrong.
Well you've created this post for opinions. I'm not stopping anyone, just making my opinion as you and others do.
Hope that's really the case because I got that vibe from your posts. If I am mistaken, then I am wrong. :) Thanks for the opinions
I'm with you there. There is many other languages we need to get rid of. But before them; let us start here with type script.
What if JS could do Types??? Maybe that is what should happen.
BTW- I see you do React. Do you do any JS?
Or any other languages and did you just start with React if you do other languages ?
Just curious because I'm a JS aficionado.
Javascript with types... is basically Typescript. But should the browser parse the types? What about the overhead of doing that? Or will we require a build step to strip out the types to have smaller files? Isn't that just Typescript again?
yeah and then I don't have to learn type-script. I would only learn JavaScript which has type script. i think. we have to concat all these languages if we are to put our energies and knowledged together in one place to reach alien technology knowledgy!!!!
If learning is your problem you might have quite some trouble in this industry
true ....if and only if ...and there is relativity to the subject matter ....There is learning something completely different but then there is learning something that is a knock off and unnecessary. The industry is not gonna go anywhere anytime soon.
Unnecessary? Why? I lerned Elixir and it changed my approach to Javascript. So, learning other styles changes the way you think. Also whatever the type hints in JS will look like, they will take notes from Typescript. There are only so many ways to go about implementing types. Learn the fundamentals, the rest is just syntax. So, when you believe types in Javascript will not require you to learn additional things you'd be very disappointed.
You can already (partially) do this in VS Code with the Deno extension (and probably other TS-related extensions) — just add
// @ts-checkat the top of your JS file. Then you can use "Infer types from usage" to get JSDoc type annotations. It won't be able to infer everything, but works well enough for many everyday use cases.You can also do the same thing in TS files (except the annotations will be TS ones rather than JSDoc, and you don't need to use
// @ts-check).Oh my this is nice! However, what I probably want is overall extinction of Typescript. Haha. TS is really good but...
But why add all this clutter if you could just have clean TS types + build-time checks?
As I say, it works with TypeScript just as well as with JSDoc. Personally I usually go with TS, but depends on your personal preference and the needs of your project as to which you choose. I'm just responding to the idea that text editors/IDEs can never infer types from usage, which is wrong.
Surprise surprise! VSCode uses Typescript tooling under the hood to achieve that!
Of course. What else is there?
I think typescript aren't merely for the sake of type-safety, but rather, a beacon for code comprehension. Types contribute in conveying the author's original intentions, making it easier for future readers to understand the code and for maintainers to make safe changes.
That's documentation.
That's right. The code is the best source of documentation.
Expressiveness stair:

Consulting Documentation should be "best" though.
Depends. If you use JSDoc, sure the hints provided by it are enough to typecheck and autocomplete, as long as you use it everywhere where the JS alone is not enough to infer the types.
If you don't use JSDoc or any other way to declare static types, a substantial part of your codebase won't be possible to be statically typechecked and therefore you won't get coding assistance.
No ... it's powerful, and it definitely has its place on more complex projects. Not saying it should be used on every project, but I'm using it on a project now and I definitely feel it has benefits there.
A good enough linter (which is just the first part of a compiler) can infer types and auto assign them. Then tell you when a type is being misused. But, I haven't seen a linter that is that good yet. Sad, since there are compilers for some languages with they type of ability. I believe the real issue is that linters are designed to be fast to process the code as you type. But, doing that much checking would make them too slow.
Just make JS have Types! But I like typescript 😅
Haha then that defeats the purpose.
Yeah, hang on. I have an image that defines this.
You are wrong. No the editors can never be smart enough without types and that's the biggest reason we need types. Is there a ton of shit in typescript: yes, should we get rid of it: no.
Pretty sure they can.
How can they know the types with no type information?
I believe in this. Im with you
\m/, and as well as others...
A programming language is a tool like any other. If you don’t like it or it doesn’t fit your use case then don’t use it. But why campaign for eliminating it altogether?
What’s the point of taking away a tool from others because you don’t like it?
Also how is the editor supposed to help with types of the programmer doesn’t tell them what the types are? Where does the ‘intelligence’ come from?
In your case, you consider TS as a programming language. I guess this post doesn't apply tothat.
It is a programming language. What else would you call it?
You are wrong. IDE's don't have any idea what really is the type of the things you put out
I know it doesn't, so I that is why I said it "should". But I see where it might be difficult, in objects.
Generics say no
Unless you use
@templatein JSDoc.unless you want to do something like this github.com/gustavoguichard/string-ts
You still need some type system... including generics and stuff. JSDoc can do that and has benefits especially for library development (no build step). But JSDoc is more tedious to write. So there are trade offs to consider. Also, in any case, you wont get runtime type safety anyways, in contrast to other languages like Rust...
IDEs and editors use Typescript tooling to do the type checking and autocomplete. So, you are wrong! Also the idea of relying on an IDE to compile your code sounds absurd to me!
Of course they do. No one said they don't.