The original: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-EUlM3wx546o.html The original Author: www.youtube.com/@uidotdev SUBSCRIBE TO THE ORIGINAL AUTHOR!!
Finally someone mentioned why TS can do all of these error marking and autocompleting stuff. Soooo many people still think that it's Editor's feature. Thank you
Most people just don't really care, and unless you try building your own IDE with something like vim, I can see why someone would think it's an editor feature. I now use VSCode, but thanks to vim I learned much more about coding than actually coding.
Certain IDEs (JetBrains) will provide some advanced type inferencing and autocomplete for a variety of libraries, even for JavaScript. It's easy to not know how Typescript helps in development when your IDE has superpowers like that.
I think Prime was a bit off on that. They just said "TS compatible editor". Which VSCode is. Not every editor will use the TS language server. Notepad isn't doing it, right? It isn't like the LSP is injecting itself everywhere you edit text, the editor is still doing a tiny bit to make it compatible.
And then you discover the RU-vid play speed extension that unlocks even more. I started with 2x -> 4x as my results. I'm now 3.5x - 5x but typically on the lower-end. There aren't many vids I watch at 1.0x these days.
@@Rexmorgan687 if you’re on desktop you can open the dev tools and do document.querySelector(“video”).playBackRate = 4; And set the speed to whatever you want. I think 10x is the most that will work. Might have gotten the syntax slightly off but you get the idea
"Has anyone tried to bring a little bit of JavaScript to their project" Yes, any dependency that has the types published separately in DefinitelyTyped is basically that, you trust the types are properly written to match the JS implementation but there's no guarantee.
And yeah, TS won mainly because of tooling. And JavaScript developers finally saw the real advantage of having types, which finally destroys their argument of liking plain JS "because it's not bloated with its syntax like Java or C#"
these are one of those things that really matter people just don't understand how important tooling and auto complete was back then, as it is something that is expected today
I really don't understand people like that. I started with QuickBASIC. I immediately saw the value of tools speeding up development time and reducing bugs. I used Eclipse for years before being directed to PHPStorm which has massively sped up dev time and code quality. For JavaScript you don't have to go full TypeScript. JavaScript Modules have brought in a lot of things that a good IDE will make use of including specifying types and autocomplete. Using .mjs and configuring your web-server gets you massive improvements to JavaScript.
To be fair, LSP wasn't standardised until 2016. The LSP stuff was started in Typescript around Feb 12, 2015, 3 years after typescript started. Also VIM and Emacs were using something similar to LSP before MS, and Omnisharp produced their own plugin based thing based on the same concept. It is more MS's protocol implementation ended up being standardised.
I think the idea that you don’t think in types using dynamic languages is so flawed. You think in types all the time, you just keep all that information buffered in your brain and act like you don’t sound deranged when you know the return types of every function and method in your project by heart. Do yourself a favor and let yourself forget by writing it down once and letting your editor or the compiler take care of remembering for you. On the flip side, it can be a bit deranged not being able to start writing a function because you need to think of its return type, so I think dynamic languages with gradual type systems and solid type inference are really a wonderful sweet spot of freedom and ease coupled with the capacity to write rigid strongly typed code when desired.
for personal projects I like to use just JS with jsdoc to get good autocompletion. thought I write types in TS syntax and had to learn it. and intellij does not always handle autocompletion well but vscode does
function f(n: number): string {}; function f(n: string): number {}; function f(n: number | string): string | number { return n; } const comment = f("Blazingly fast"); // comment is a number
To this day I'm still surprised at how absurdly loooong it took to TS be in the mainstream. LSP was already implemented in VSCode and WebStorm and others even 5-6 years ago. But for some reason still, JS devs were so masochistic and stubborn about using plain JS even on big production sites. And in some jobs, I needed to make special presentations for teammates on why we should use TS, because people were so afraid of the TS thinking that it is C#'ified version of JS. Even if some of the folks started to see the benefits of using types, they were still so afraid of using TS that they decided to use Flow (oh god) Finally, I can peacefully rest on the farm with work (of promoting TS on social media) done like Thanos. I have a huge smile on my face when I see library creators treating great type inference as one of the priorities We have come a long long way, but now tooling in our JS world seems to start becoming simplified (especially with Svelte and Solid) Good times are coming guys
@@micycle8778 Nothing. Just plain JS people portrait C# as "overbloated overcomplicated language from super evil corp Microsoft that focuses on OOP only"
They added async/await 8 years ago now so it has been a minute. But around that time it was already attracting some more, hmmm, disciplined engineers and a lot of great projects popped up around that time and/or moved to TypeScript that were just a cut above most of what was going on in the JS ecosystem at the time.
For the MS lsp suing thing, are html_language_server and pylance the only two or there's more under them? I'm assuming the ones from here (with MS as maintainer) being out of bounds.
I have "html-lsp" installed on my Neovim and when I inspect it with Mason it does show the git-hub repo of "microsoft/vscode-html-languageservice" as the source. And I couldn't find "pylance" but there is one lsp called "pyright" that's also linked to a MS git-hub repo. I checked the repos and both have the open source "MIT license"!
no, it was not available on every language and for free ides netbeans came a long and started to change that, and then vscode did give us LSP which has helped a TON make it so every editor has autocomplete
yes I've brought JS into a TS project a few times. Usually it's a pain in the ass to get the module to declare as any OR pain in the ass manually writing the types for the things you use from the module OR taking the types from a PR that's the package owner won't merge to add support.
Inception speed, when you watch in 1.5x and that video plays a video in 1.5x 😮 Now it just sounds like people are talking too slow IRL 😂💯 BLAZINGLY FAST 🤩
The second you try to bring Vanilla JS with typescript, you at least need to start adding "@ts-ignores" everywhere and type everything you import as "any". So it's not really "just import vanilla js code", it's never that easy.
@@frankcooke576 Well, yeah, you can do that. And that was the point, that you are required to do something, even if it's minor, to get it to work. Whether it's declaring an empty module or adding @ts-ignore. But you can't just import a js module and it just works immediately,
Understood. That still makes your original comment inaccurate though. You can declare an empty module and then import and use any js module without the aid of types. No ts-ignore and no any types. Obviously not ideal, but honestly any library worth using (or trusting) nowadays either is written in TS, includes the types, or has types provided by the overwhelming large community.
Yep, LSP is in lots of editors now. As long as you have a server for your language, like clangd for C++, any editor can give you syntax highlighting for anything. Often those servers are managed by plugins in the editor, but sometimes they're standalone executables that the editor can call.
I did pair programming with one guy. I have showed him 3 times auto completion by ctrl + space to see if he will use it later. You will be surprised...for over 2 hours he couldnt finish the object with specific string type, he was trying type so many weird shits and i was waiting for like an hour atleast to see if he will remind himself about this shortcut and feature... after 2 hours i was done and i just told him "press ctrl + space" and he was "Im always overenginnering all what im doing" and i was like "i did show you this feature 3 times before i let you finish the training code for purpose reasons"
LSP had very little to do with the success of typescript. If you go back to 2015, there was still no real consensus on whether flow, typescript, or dart was going to be the defacto compile to is language. What pushed Typescript over the top was when Google decided to use it for Angular 2. At the time, Angular was more popular than React by quite a bit, and most React dev were using Flow. Google adopting typescript tipped the scales .
Tooling is how Microsoft wins in general. Making you depend on them is how they keep their revenue and market share. You are never on the bleeding edge but you are stable
Is like recreating the bouncy scroll on a website and getting sued by Apple because they have a patent on the damn thing. Ask me how i know. I think it was invalidated late last year.
You can simply declare an empty module for any untyped external js dependencies and then use it like any other module. No types of course but it's literally a single line of code to get er done.
The problem with you playing these videos at 1.5x is that if I play your video at 1.75x (which is my normal speed), the original video is barely understandable.
incorrect, the Intellisense is there for over a decade in VS, they just implemented this for Typescript, using LSP, it is the type which drives it. Also, Intellisense is just part of it, a big part of TS success is the ease of refactoring which happens all the time. It is never about LSP, implementation detail never matters.....never, ever
I honestly didn’t like the video prime’s reacting to. Talking about “why ts won”, but against whom? Against regular JS - no chance. I’m honestly really keen on flow. I like haskell-like (ocaml inspired) type inference that just derives types from the way you use values. I also like having closed objects types, that cannot have more enumerable properties than is required (really handy for using Object.keys/values/entries in a type-safe way) I think the better question is why ts won against flow, than just regular js.
TypeScript won against Flow because Flow is (or at least was) unusable. It ate at least 8 GB of RAM on a regular Express app and was slow and inconsistent.
I had to write an embedded page on my chorus's google sites, and it was painful to use vanilla html, css, and javascript. You really never can go back.
When you set the video speed to 1.5 I have to change my video speed back to 1.0. I think we all do set the video speed up. Their should be a faster way to toggle button between 2 perefered speeds we want to see our content in. I want to toggle between 1.0 speed and 1.5 speed. By pressing my keyboard or the video bar.
I guess there is a possibility that all code goes the same way with LSP? I dont like a one way language, but then again I dont work in a company coding just doing it for fun. And I like if I can solve problems in different ways without getting hit on my hands by a lsp
This sounds like you're confusing lsp with a type checker. Regardless, here's the question you should be asking about types: would you rather stop in the middle of using your application to hunt through a stack trace looking for clues about where the bug might be, or would you rather be told about that typo you just made before your cursor is even on the next word?
@@ThePrimeTimeagen the typical EEE sayer don’t even know which of the Es is in effect now 😅. It seems it’s always the E that “makes” sense to make an argument. Just check HN to see it in full effect.
I think the original video was being oversimplistic and really skipped on a lot of things. LSP being one of them but the sheer fact that it's UNBEARABLE to use vanilla JS in anything that has to be designed with scale in mind
I would switch from Typescript to Rust if Rust didnt need to compile so long on every change. I love being able to hit :w and see changes almost immediately. As far as I can tell rust is just too damn slow to compile for UI dev.
You have no idea what you talking about. If typescript was bad as how you want to portray it, WHY SOO MUCH GROWTH. If you don't like don't, but we the community of TS love it
ahh, I really couldn't guess why people like TS and I never used it. I guess because I don't use LSP. I just use ctags or some variation thereof and my brain. tbh I think LSP lowered code quality a lot, people are able to write more needlessly complex code than ever (basically the java/intellij phenomenon). Sometimes you want a soft limit on that by using tools that strongly encourage you the other way and to write better names so types are not hard to guess.