for anyone interested in a deep dive with the PR author: we recorded an in-depth (more than an hour) video with Dan Vanderkam on his PR on inferred type predicates (the top feature) and it's launching later this week.
@@kasper_573 thanks! we're really excited about it: we covered the whole story from how he got the idea all the way to the approach he took (Anders himself commented that it was a really unique technique compared to what else has been done in the compiler before).
I would totally agree for subtype polymorphism and totally disagree for ad hoc polymorphism. I never feel like I need gymnastic to e.g. implement traits in Rust code. But I definitely feel it when working on OO TS code.
Personally, I like the increase in type inference. It can be difficult to implement, but I think it's worth it. As I've been working on my own language I've slowly been working towards anonymous structs being basically just another tuple type and that leads me towards arrays not needing a type at all as I'm already using brackets for both tupling and arraying. Eventually, I may end up using braces only for code blocks, and I kind of like the thought of that.
Of course this wouldnt actually happen as it would break the internet, but I like to sometimes sit down an imagine the chaos that would ensure if javascript actually made a breaking change
@orionh5535 I don't buy that. Files with a special "use ..." header and it's done. The more probable reason why it doesn't happen is that V8 would need to be reworked, and that costs many 10s of millions.
God looks like ts monorepos pain won't be as as bad and it's getting better. Massive shoutout to Julius whose t3 turbo has a beautiful setup that just works!
nice shirt, nice video, nice update, do you think that there will ever be a day in which we can explicitly state that a function has a chance to throw an exception in TS? maybe it's fine the way it is with try/catch/JSDoc annotations but it always felt weird to me
If implemented in a backwards compatible way (which is a must) would not make too much sense. Like sure, for your own code, or newer versions of some libraries is nice. The problem is that all existing code has no exception info in the signature. Which means that every function can throw. Even so, when using internal code or updated libraries it is nice. Anyway, something which is way better than exceptions is return values. Think of Option (can be Some(value) or None)), Result (Ok(value) or Error(error_data)) and so on. For example, in Python errors as values and Optionals are not “native” but with the returns package you can do it very ergonomic. Given that what you want will probably never happen, you can use errors as values in your code today
I don't get jsdoc over ts. Like, I understand for maybe small scripts contained in a single module. But if you're getting to the point where you're needing to import things from other modules, I don't see why it's not just worth it to start with TypeScript. Unless you have a good reason that you can't use one of the many templates available, it doesn't take any effort to set up.
I've been using ts in jsdoc for a while now. It helps me to quickly add typing here and there and slowly help the code base. If i need to edit an old js file, i can enable ts-check, do my thing and disable it since 90% of the file is red. It sucks a bit but it's better than nothing. And forget migrating to ts, too much work, needs to be iterative. It's far from perfect like you need to have the file open for vscode to scream at you. That said there's an experimental feature for that but it's slow in huge code base and create a lot of noise.
And it's still just papering over JS's inadequacy. God I wish we could just deprecate JS entirely and use something else... WASM would be a good option since you can compile more or less anything to it, but they've explicitly designed it to not be a full on replacement for JS.
JavaScript is pretty much a curse, no ones likes it and there has been so much work to "improve" it, but in the end, we are left with a HUGE pile of over engineered spaghetti mess of tools, libraries, frameworks and god knows what and whats worse is that now its too late to do anything about it now.
I watched this video and literally 30 minutes later I got annoyed by the same type type inference issue described in the video regarding array filtering... Well screw it, TS 5.5 is close enough I might as well use it already...
I don’t understand why people insist on seeing in black and white. The question of whether you should annotate your return type explicitly, clearly does not have a correct answer independent of context. Can we stop encouraging developers to accept simple answers and start encouraging nuance and critical thinking instead? 😩
Hiya Theo! Thanks for the video; I'm a self-taught developer and I really feel like I'm part of your community with these! Quick question (and super sorry if this is inappropriate/unwarranted viewer comment): But why aren't the videos shorter in general, like say Fireship? Is it because they are extracts from Twitch streams? E.g. I loved this title and was very curious about what you had to say, but seeing the 30-minute time intimidated me a bit now. [Edit: Thanks for all your hard work!!]
Why you feel the need to state that you are a 'self-taught developer' when speaking? I mean, I'm not judging, I am as well, but this sounds like a very artificial behavior and I want to understand the rationals.
@@t3dotgg Of course! As you always should - I'm a fan and grateful for your videos. Huge apologies if I inadvertently annoyed you; genuinely came from a loving-viewer, good place.
@@diadetediotedio6918 Because it makes me more appreciative of creators like Theo, who create remote communities that I could not experience at a university. It feels good to be a part of a community.
this is great, a lot of the things here are reasons why I often prefer to just use JS now over TS when I'm not working on a large library or framework. Now, it appears that I can jump into TS without needing to constantly add all the TS boilerplate things, and just jump into the code. love it!
English is not my first language and for some reason pronouncing regex as "rejex" makes me think of the word "rejects" (even though the "re" part is different) 😄
I tried to use Typescript twice in my discord bot project. Both times I ended up just manually writing the CommonJS equivalent after I confirmed that the TS could compile and was type safe because the packages I required weren't made for ES modules and as such I had conflicts in build. I want to update to ES modules and TS but because of the dependencies that aren't on ES I'm stuck on CommonJS until it either gets updated or I bite the bullet to rewrite it to migrate away from the outdated packages.
Watching TypeScript and JavaScript develop is like watching somebody build a supercar by starting with bottlecaps, toothpicks and compressed air and fumbling along mindlessly.
Theo about to spark a debate on how you should pronounce "regex". Sorry Theo, I don't say "rejular expressions" so regex is "reg(ular) ex(pression)". You're pronouncing it wrong :P
Trying to enunciate "Reg Ex" a few times in a sentence when talking fast makes the sentence sound too stuttery because you need to add a pause between the G and E. The sentence needs to be more fluid and flow-y to feel natural and comfortable to speak. Sometimes we can shuffle things around by removing the first stress, removing the pause, and starting the second stress (which is now the only stress) one phoneme earlier, but that turns "Reg Ex" into "re'Gex" which is still too stuttering to be comfortable to say repeatedly. But the Hard G can then be slurred into a Soft G (J sound) turning "re'Gex" into "re'Jex", and now we can bring back the first stress (but keeping the second stress starting that one phoneme earlier to keep it comfortable) which turns "re'Jex" into "Re(h) Jex". Then the natural pace of talking fast when needed simply plucks out the unnecessary space turning "Re(h) Jex" into "ReJex".
Oh, please don't talk about "explicit return types". I completely disagree with you on that and the debate should not be brought up again 😂 I want to be the one deciding what my function returns, not TS. TS always infers something, even if I made a business-logic mistake. So yes, be explicit about what your intention is with the function.
You don't need to use implicit returns, but they are indeed useful. Sometimes for quick prototyping they are everything you need, and most of the times TS can correctly infer the return types based on what you effectively returned, so unless you are doing something very wrong (and are unable to hover the function to see what it infered or enable type hints) it should suffice.
dude's reactions are fake asf lol. These updates are nowhere near good enough for such a enthusiastic response. I understand the peculiarities of the blogging profession, but the falseness is nauseating
This is like a bot thing? Almost every video from every language there is 1 or 3 people like this that are just randomly stating the language should not exist like a generic hater.
year 99 of Hoping for pattern matching and curried pipe chains
I would give my soul for if expressions
I wouldn’t hold my breath for pattern matching in typescript better to wait for it to hit JavaScript than typescript
Try ts-pattern
Who is also the Rx lover ?😊
I use ts-pattern, it does the job 👍
Finally someone acknowledges birds aren't real.
Everybody knows that the bird is the word
People are waking up.
Finally! Mainstream media doesn't dare to report on this!!
Exactly, I've been telling people its the drones but they think im crazy
yes, they are all dinosaurs!
"Undefined is no longer a valid variable name"
WHY ONLY NOW
These types of video really keeps me up to date with the Javascript/Typescript world. Thank you Theo!
for anyone interested in a deep dive with the PR author: we recorded an in-depth (more than an hour) video with Dan Vanderkam on his PR on inferred type predicates (the top feature) and it's launching later this week.
Heck yes! Looking forward to it!
@@kasper_573 thanks! we're really excited about it: we covered the whole story from how he got the idea all the way to the approach he took (Anders himself commented that it was a really unique technique compared to what else has been done in the compiler before).
hell yessss ❤
update: it's live!
Explaining modern frontend development to new devs is so hard because of all years of context to explain all the over engineering we've done.
It's hard because of all the garbage tech like React
function isBirdReal(bird: Bird) {
return false;
}
const isBirdReal = false;
return false as NoFlyLikeAnEagle
GetCategory("bird");
> undefined
Error: "bird" is defined but never used
I love that we accept argument "bird" and just never actually consider it. TypeScript may give that an error, but that's pure logic in my eyes.
5:20 "name" in user
Hasn't this been a thing for a while in TS? I have been using this type narrowing quite a bit in my code.
It has. Theo is just a useless web developer who knows nothing 😂
The typical React developer 🤷♂️
I like your voice, Theo. Kinda wish it was on my GPS system, criticising the state of the roads.
the mental gymnastics you need to go through just to have type "safety" but also be able to somewhat make use of polymorphism is crazy
I would totally agree for subtype polymorphism and totally disagree for ad hoc polymorphism. I never feel like I need gymnastic to e.g. implement traits in Rust code. But I definitely feel it when working on OO TS code.
It's not type safety, it's autocompletion. Instead of Typescript it should have been called AutocompletionScript
I loved when Theo said that he’d never seen the jsdoc import - but next and tw in t3 both use it 😂
He very much doesn't work on t3
The real question is why it took a decade to get this landed?
Mate deserve some support in his channel.
thanks Theo
Typescript Is the one library I never think about and I think that’s a good thing
TypeScript is the one pile of shit I never use and I think that's a good thing.
@@epajarjestys9981 if you write javascript without typescript and you're proud about it... nothing good about it
Even if I didn’t dev, I would still relish this channel! “…but we’re talking about undefined birds…”
1:44 "All birds aren't real" indeed brother.
Love these ts release note walkthroughs!
I just want a way to mark that a function throws and interrupts the processing flow
What a coincidence, I was using lodash for my Sets, now there's a better option. Very neat!!!!
Bird is bird, but is bird the word?
Personally, I like the increase in type inference. It can be difficult to implement, but I think it's worth it. As I've been working on my own language I've slowly been working towards anonymous structs being basically just another tuple type and that leads me towards arrays not needing a type at all as I'm already using brackets for both tupling and arraying. Eventually, I may end up using braces only for code blocks, and I kind of like the thought of that.
“All birds aren’t real” loved it 😂
8:10 yeah man tf this import syntax exists for like 2 years already
Literally like an hour ago I was handling the undefined in arrays haha
still no throws keyword feelsbadman
At this point, just make JavaScript strongly typed
I wonder how much performance you could gain by doing that
Of course this wouldnt actually happen as it would break the internet, but I like to sometimes sit down an imagine the chaos that would ensure if javascript actually made a breaking change
@@orionh5535 typescript is a superset of javascript, right? (let's ignore enums) so it should work to - in theory - support it directly.
"use types" at the top of the file and we gucci
@orionh5535 I don't buy that. Files with a special "use ..." header and it's done. The more probable reason why it doesn't happen is that V8 would need to be reworked, and that costs many 10s of millions.
So basically the "type gymnastics" people used to complain about in Typescript are now gone. There's no excuse not to use typescript now lol.
God looks like ts monorepos pain won't be as as bad and it's getting better.
Massive shoutout to Julius whose t3 turbo has a beautiful setup that just works!
I was working on a library and I stopped working on it because of the type issues that should be fixed, get to dust that off and finish it
Theo: auhh this is huge..! auhh thats nice...! auhh this also makes...!
nice shirt, nice video, nice update, do you think that there will ever be a day in which we can explicitly state that a function has a chance to throw an exception in TS? maybe it's fine the way it is with try/catch/JSDoc annotations but it always felt weird to me
If implemented in a backwards compatible way (which is a must) would not make too much sense.
Like sure, for your own code, or newer versions of some libraries is nice.
The problem is that all existing code has no exception info in the signature. Which means that every function can throw.
Even so, when using internal code or updated libraries it is nice.
Anyway, something which is way better than exceptions is return values.
Think of Option (can be Some(value) or None)), Result (Ok(value) or Error(error_data)) and so on.
For example, in Python errors as values and Optionals are not “native” but with the returns package you can do it very ergonomic.
Given that what you want will probably never happen, you can use errors as values in your code today
Another option is to take a look at ReScript. It is very nice. There are a few vids on yt about it.
Was about time to fix basic errors like ESM resolution lol
Everyone knows that bird === theWord.
not filtering out undefined is one of the most annoying errors
here comes the return type annotation war again
I don't get jsdoc over ts. Like, I understand for maybe small scripts contained in a single module. But if you're getting to the point where you're needing to import things from other modules, I don't see why it's not just worth it to start with TypeScript. Unless you have a good reason that you can't use one of the many templates available, it doesn't take any effort to set up.
I've been using ts in jsdoc for a while now. It helps me to quickly add typing here and there and slowly help the code base. If i need to edit an old js file, i can enable ts-check, do my thing and disable it since 90% of the file is red. It sucks a bit but it's better than nothing. And forget migrating to ts, too much work, needs to be iterative.
It's far from perfect like you need to have the file open for vscode to scream at you. That said there's an experimental feature for that but it's slow in huge code base and create a lot of noise.
And it's still just papering over JS's inadequacy.
God I wish we could just deprecate JS entirely and use something else... WASM would be a good option since you can compile more or less anything to it, but they've explicitly designed it to not be a full on replacement for JS.
JavaScript is pretty much a curse, no ones likes it and there has been so much work to "improve" it, but in the end, we are left with a HUGE pile of over engineered spaghetti mess of tools, libraries, frameworks and god knows what and whats worse is that now its too late to do anything about it now.
I watched this video and literally 30 minutes later I got annoyed by the same type type inference issue described in the video regarding array filtering...
Well screw it, TS 5.5 is close enough I might as well use it already...
I don’t understand why people insist on seeing in black and white. The question of whether you should annotate your return type explicitly, clearly does not have a correct answer independent of context. Can we stop encouraging developers to accept simple answers and start encouraging nuance and critical thinking instead? 😩
You're expecting too much from web developers in 2024 lol
Hiya Theo! Thanks for the video; I'm a self-taught developer and I really feel like I'm part of your community with these! Quick question (and super sorry if this is inappropriate/unwarranted viewer comment): But why aren't the videos shorter in general, like say Fireship? Is it because they are extracts from Twitch streams? E.g. I loved this title and was very curious about what you had to say, but seeing the 30-minute time intimidated me a bit now. [Edit: Thanks for all your hard work!!]
"The biggest TS update in years"
Because I make videos the length I want to :)
Why you feel the need to state that you are a 'self-taught developer' when speaking? I mean, I'm not judging, I am as well, but this sounds like a very artificial behavior and I want to understand the rationals.
@@t3dotgg Of course! As you always should - I'm a fan and grateful for your videos. Huge apologies if I inadvertently annoyed you; genuinely came from a loving-viewer, good place.
@@diadetediotedio6918 Because it makes me more appreciative of creators like Theo, who create remote communities that I could not experience at a university. It feels good to be a part of a community.
this is great, a lot of the things here are reasons why I often prefer to just use JS now over TS when I'm not working on a large library or framework.
Now, it appears that I can jump into TS without needing to constantly add all the TS boilerplate things, and just jump into the code. love it!
1:40 it's the opposite: TS wasn't smart enough.
The birds aren't real ref got me, can't watch past that. Iykyk.
Why does AI have to suck at regex worse than I do?
Because regexes don't split up into multi character tokens for LLMs very well?
English is not my first language and for some reason pronouncing regex as "rejex" makes me think of the word "rejects" (even though the "re" part is different) 😄
2:00 FINALLY
bird is a word
That viewer was right, this shit should have been 5.0
This MS whistleblower must be protected at all costs.
All I want is project wide type checking 😥
Now my boss will expect me to identify if an image has a bird in less than 5 years and without a research team ;_;
I tried to use Typescript twice in my discord bot project. Both times I ended up just manually writing the CommonJS equivalent after I confirmed that the TS could compile and was type safe because the packages I required weren't made for ES modules and as such I had conflicts in build. I want to update to ES modules and TS but because of the dependencies that aren't on ES I'm stuck on CommonJS until it either gets updated or I bite the bullet to rewrite it to migrate away from the outdated packages.
But typescript doesn't depend on ESM. You can easily use typescript and build to commonJS. Iirc it's the default.
You can set the build target to commonJS ( in tsconfig )and yes thats the default behaviour
wait this is cool af
It's big. Python should have this. Undefined
Too much Bird
i wonder…..have you heard….the word?
So now we know for sure that the bird is the word?
Larry Bird 🐦
Watching TypeScript and JavaScript develop is like watching somebody build a supercar by starting with bottlecaps, toothpicks and compressed air and fumbling along mindlessly.
It's pronounced REJular expression
Thanks
Oh yeah that filter thing was so annoying. Nice!
the more i have been learning rust for the past year, the more im starting to hate ts
All hail the bird: th-cam.com/video/9Gc4QTqslN4/w-d-xo.html
finally ts got rid of this "is possibly undefined" sh*t
bird
Theo about to spark a debate on how you should pronounce "regex". Sorry Theo, I don't say "rejular expressions" so regex is "reg(ular) ex(pression)". You're pronouncing it wrong :P
Trying to enunciate "Reg Ex" a few times in a sentence when talking fast makes the sentence sound too stuttery because you need to add a pause between the G and E.
The sentence needs to be more fluid and flow-y to feel natural and comfortable to speak.
Sometimes we can shuffle things around by removing the first stress, removing the pause, and starting the second stress (which is now the only stress) one phoneme earlier, but that turns "Reg Ex" into "re'Gex" which is still too stuttering to be comfortable to say repeatedly.
But the Hard G can then be slurred into a Soft G (J sound) turning "re'Gex" into "re'Jex", and now we can bring back the first stress (but keeping the second stress starting that one phoneme earlier to keep it comfortable) which turns "re'Jex" into "Re(h) Jex". Then the natural pace of talking fast when needed simply plucks out the unnecessary space turning "Re(h) Jex" into "ReJex".
Oh, please don't talk about "explicit return types". I completely disagree with you on that and the debate should not be brought up again 😂 I want to be the one deciding what my function returns, not TS. TS always infers something, even if I made a business-logic mistake. So yes, be explicit about what your intention is with the function.
You don't need to use implicit returns, but they are indeed useful. Sometimes for quick prototyping they are everything you need, and most of the times TS can correctly infer the return types based on what you effectively returned, so unless you are doing something very wrong (and are unable to hover the function to see what it infered or enable type hints) it should suffice.
strick: false
How annoying these antics on the preview
why do you always do a weirdo face on the thumbnails?
honestly I dont care
Cringe thumbnail
JS is still years behind other languages.
How so?
not in libs tho
refuses to elaborate
@@vitosnatiosexample?
C# is so so so far ahead, it's laughable tbh the state JS is in considering it's the most used language in the world
dude's reactions are fake asf lol. These updates are nowhere near good enough for such a enthusiastic response. I understand the peculiarities of the blogging profession, but the falseness is nauseating
First🎉
at this point just make a new freaking language than this shitty js ecosys.
can we please deprecate TypeScript altogether?
Why?
This is like a bot thing? Almost every video from every language there is 1 or 3 people like this that are just randomly stating the language should not exist like a generic hater.
th-cam.com/users/shortsksBNx1vBm_0?si=9SU5il2EnGxUO07M
They forget the "cia__spyOnCivilans" function on the bird type but ok