Ths is awesome! Do you think you'll update your tsconfig package once TS 5.8 is generally available?
@timothyshiu226318 сағат бұрын
Amazing! Can one use the open source Deepseek?
@studiowebselect18 сағат бұрын
i havent try with Deepseek with api, but you can install it with ollama. So you should be able to use the API. I just dont know for the <think> section and structured output.
@Nurof3n_18 сағат бұрын
YESSSSSSSSSSSSS!!!!!!!!
@uthpalax19 сағат бұрын
Amazing tutorial. Thank you very much
@mohammadfallah365621 сағат бұрын
Awesome
@maximilian098765432123 сағат бұрын
Thanks for this fantastic tutorial!
@hasst926123 сағат бұрын
Thanks a lot
@alvingultiano7513Күн бұрын
Do you accept apprentice ? master
@ortervesКүн бұрын
I want to default to using type but the bloody linter whinges and I'm not allowed to disable it
@ortervesКүн бұрын
Typescript, the only language where a simple keyword like enum is a pitfall and beginners are encouraged to create weird boilerplate in its place. And yet enum seems to work fine and the weird boilerplate throws syntax warnings.
@mattpocockukКүн бұрын
Lol TONS of languages have pitfalls a lot worse than enum
@ortervesКүн бұрын
@mattpocockuk yes but people don't pretend they are good But I read more about it and there's nothing actually wrong with typescript enums as long as they have a string definition, so that's cool
@LauriePoulterКүн бұрын
What does structured data do if it can't find what are you ask it in the data? Would happens for instance if you pass it a blank invoice in your example, will it hallucinate?
@mattpocockukКүн бұрын
Great question! I'll think about that for the course.
@studiowebselect18 сағат бұрын
You can make optional some field. So it wont fill when he dont find the value. Else, yes, it can hallucinate a lot. llama vision 3.2 hallucinate a lot more than chat gpt 4o
@w01dnickКүн бұрын
Don't like it. There are constructive code generations. While enums (in TS) and namespaces aren't constructive, constructor parameters are. Also wish we had type to code generation, something like type MyType = 'foo' | 'bar'; let x: MyType; if (element.dataset.id in MyType) x = element.dataset.id; Because manually writing element.dataset.id === 'foo' || ... Is tiresome and error prone when you extend MyType later.
@dkazmer2Күн бұрын
2 questions: What's wrong with that third example? And what is meant by "erasable"?
@kakschoenКүн бұрын
Erasable means it can be stripped at runtime. Non-erasable typing actually affects how your code behaves, erasable typing is only visible to the developer/typescript compiler. Enums are non-erasable, as code gets generated in its place; they're a form of syntactic sugar.
@dkazmer2Күн бұрын
@@kakschoen that was clear, thanks! I think they get stripped at compile time, though, no?
@mattpocockukКүн бұрын
Enums do not get stripped, they get compiled into a different form.
@dkazmer217 сағат бұрын
@@mattpocockuk makes sense now, thanks! Shoulda been calling "strippable..."
@NaR00WКүн бұрын
Wtf I’m no longer a wizard?
@mattpocockukКүн бұрын
Everyone else got the normal greeting
@jelloace3097Күн бұрын
You should probably explain what's the problem with enums and namespace rather than just calling them weird. I still don't understand what this flag for tbh. If you opt to disable, then what's the alternative?
@arvendrellКүн бұрын
Hey Matt, do you know if it possible to work with a custom REST API instead of using any already integrated LLM? I am able to save the info, but do not see the stream response withouth refreshing the page. Thank you
@ZigaKrasovecКүн бұрын
The image that you used for the imageUrl example is Lake Bled, Slovenia 🇸🇮 10mins away from my home town!
@ZigaKrasovecКүн бұрын
🤦♂should have watched the next 5s of the video before posting the comment, of course LLM describe it for you lol
@mattpocockukКүн бұрын
Absolutely wild!
@thephoenixstudioКүн бұрын
Eh, enums are more readable, dont accept bare strings, and dont require 3 steps to create. So ill stick to them.
@2mbst1Күн бұрын
The link to the PR in the description needn’t and shouldn’t point to x, instead it should point to the PR directly.
@mattpocockukКүн бұрын
It should! Fixed.
@2mbst113 сағат бұрын
@@mattpocockuk 💙🙏
@edgeeffectКүн бұрын
Nom! Nom! Nom! Very tasty! 🏁🏁🏁🏁🏁🏁🏁 😃
@jazzdestructorКүн бұрын
nice wanted something like this as making agents with js was a pain. I am gonna try more stuff out, thanks a lot Matt
@Tommy-eu2fb2 күн бұрын
1:20 Eeek I'm excited.. Need a weekend when I'm not going away to indulge in this!
@johnconnor97872 күн бұрын
Why everyone says that enums are odd? Why exactly? Or it is just so.e tradition not to like it?
@pavolhejny2 күн бұрын
For me enums, namespaces (and modules + references) are obvious nonos from day 0, but private and protected properties seems good practice to use together with _ prefix. Or am I somewhere wrong?
@mattpocockukКүн бұрын
Yes, private and protected properties are not going away - just the automatic assignation in the constructor.
@pavolhejnyКүн бұрын
@mattpocockuk Yeah I know but still are they really bad practice to use? In your code, do you do this implicit assignment or assign values explicitly in the body of the constructors?
@pavolhejnyКүн бұрын
@mattpocockuk `public` vs. `Object.assign` - This is a minor thing but underlying a major tradeoff: In my company, codebase readability is probably worth more than direct portability across the runtimes and configurations, or do you think that it is the other way?
@mattpocockukКүн бұрын
@ I assign values explicitly. And I don't understand why you're comparing public and Object.assign - they feel unrelated to me.
@duytdl2 күн бұрын
Why didn't Node implement it though? Too hard or do they not like it?
@mattpocockuk2 күн бұрын
Because: - You need to ship source maps to make it work - It ties Node in somewhat to TypeScript's runtime syntax, which is not a dependency they want - especially when the TS themselves are signalling that it's not the future of TS.
@allan_archie2 күн бұрын
Why not just fix them?
@mattpocockuk2 күн бұрын
Sure, go for it
@aaronmorgan44662 күн бұрын
Wasn't sure what your problem with enums is, I like them, particularly as semantic keys. But, I went and found your video on enums, as const from now on.
@zakir.nuriiev2 күн бұрын
What is the problem with enums?
@twigsagan3857Күн бұрын
It seems they dislike that those are checked runtime. But I have the same question. Because to me it is more important write clean code with the tools a language gives me than how the language supports such a feature.
@zakir.nuriievКүн бұрын
@twigsagan3857 Agree 👍
@zardify_22 сағат бұрын
@twigsagan3857 same. And I think all of this is mostly about Node, and NOT browser. TypeScript doesn't really do anything at runtime in a browser... it's transpiled...
@Dxpress_17 сағат бұрын
I guess partly it's because union types exist that can do the same thing without any extra syntax overhead, while also still having intellisense capabilities. Sometimes enums can also be transpiled differently depending on how they're written. I can't remember exactly, but say if you wanted to get all the values of an enum type via Object.values(), it will return essentially the same values twice, but with the keys and values swapped. Something like: { 1: "ValueA", 2: "ValueB", "ValueA": 1, "ValueB": 2 }
@Felipe-532 күн бұрын
Your content is great, my friend. Thanks!
@TactileNoseButton2 күн бұрын
Javascript is the weirdest language ever made. I still don't get how this mess has become the world standard for Web.
@ruimarcosjoao2 күн бұрын
very cool
@orderandchaos_at_work2 күн бұрын
Great, now each and every dev can write their personal style of enums all over the code base.
@billgrant72622 күн бұрын
what bizzaro world is this? everyone wishes they had enums in languages that dont
@robertsandiford62232 күн бұрын
TypeScript is not a language, it's a type checker, so it goes against the modern standard that TS shouldn't be involved in runtime issues. Also enums are a little weird. You can code a typesafe Enum equivalent if you really want, or get similar results with simple things like objects.
@akikadze2 күн бұрын
You still have an enum alternative. Something like this should work: const myEnum = { value: "value", value2: "value2" ...} as const; type MyEnumType = typeof myEnum[keyof typeof myEnum];
@mattpocockuk2 күн бұрын
I'd love enums in JavaScript. But TS enums are odd.
@thephoenixstudioКүн бұрын
@@akikadzeThat's a lot more work than an enum
@twigsagan3857Күн бұрын
@@robertsandiford6223to me it is a language since I don't consider Javascript to be up to the task of scaling software. Typescript gives you options to keep you code clean. And it shouldn't matter from that perspective whether they do stuff runtime VS compile time. Enums make your code more stable.
@bergerblancsuisse.2 күн бұрын
1:48 would be great if you could link to the videos or create an updated video regarding the alternatives, please :)
@anonymous25962 күн бұрын
Alfons Åberg's dad became a developer, that's crazy.
@georgehelyar2 күн бұрын
Imagine how happy you could be if you removed all the TypeScript features... and JavaScript quirks... and used a better language instead.
@weirdwordcombo2 күн бұрын
parameter properties was a great achievement of C#, like async/await also. typescript copied lots of features. these features are such a success because they are very intuitive, very much used and very anti-boilerplate. nodejs team seems not to understand. they can support it. but i guess they like a "clean" "no effort" type-strip solution. sad.
@DemanaJaire2 күн бұрын
I would love it if not the constructor thing. But I don't use classes, so I guess I'm okay with it.
@weirdwordcombo2 күн бұрын
stop saying DTOs are bad in comments. I use tsyringe as DI container. massive boilerplate incoming if i use this flag I guess. horrible. classes are used for much more than DTOs. this is a major issue if you are forced to use nodejs with native typescript support I guess. nodejs should support transpilation plugins like babel.
@MarkWiemer2 күн бұрын
Good thing the flag is optional :)
@weirdwordcombo2 күн бұрын
but those parameter properties are very useful, because they reduce the amount of code i have to write. without those I'd need to assign each property manually in the constructor. i would also have to keep property and parameter name in sync manually, because I like consistent naming. any thoughts? or am I wrong? how can I otherwise reduce work and boilerplate if not with parameter properties? if babel supports it with plugins, so should nodejs. no excuse.
@robertsandiford62232 күн бұрын
Why would node support something that isn't in the Ecma Script spec?
@weirdwordcombo2 күн бұрын
@@robertsandiford6223 nodejs should adopt all TS feature because there are TS devs who use them and they want to use them when they switch to vanilla nodejs also. That is a very practical down to earth argument, would you agree? What point would strictly following ecma spec have in this case? I agree that nodejs JS should follow ecma spec because its JS. But nodejs TS should follow TS spec. These are 2 different things.
@robertsandiford6223Күн бұрын
@@weirdwordcombo TS has moved away from runtime features as that would create a clash between TS runtime features and new features added to JS itself. E.g. JS may one day have its own enums. We're not going to see further development of TS runtime features and support for them.
@omri93252 күн бұрын
This flag is like a deprecation for the non-eraseable syntax :)
@лилпипка2 күн бұрын
I wonder what will happen to using keyword now, they've added it not that far ago
@mattpocockuk2 күн бұрын
It's a JavaScript feature, so no need to erase it
@TheSublimeIbanez2 күн бұрын
I wholly disagree with your perspective on this and the potential (extreme) edgecases aren't anywhere near enough of a deterrent for me. Furthermore, Enum.Key is very useful syntax and avoids maintenance issues down the line of "Where are they getting that value?" if you're passing in strings. Explication is a good thing and enums can provide that to some degree whereas raw JS struggles to.
@snatvb2 күн бұрын
class constructor properties is really good :( enums bad, yep
@adnan76982 күн бұрын
Rooter
@dasten1232 күн бұрын
idk how I feel about this... I think it's more the job of a linter to enforce things like that, isn't it?
@dasten1232 күн бұрын
but the class parameter properties thing is awesome, though
@8_ball_z2 күн бұрын
lol! so cool
@rodrigonovais96242 күн бұрын
So, Node, after more than a decade of existence decided will implement typescript but doesn't, so to fix it, typescript itself changes Wouldn't it be better to, ACTUALLY implement typescript instead of just rename the extensions form "ts" to "js" and pretend everything is fine?
@mattpocockuk2 күн бұрын
No, because I think everyone involved (Node and TS team) see this as a possible sea change moment to get rid of some features that they're not interested in supporting. TS's future is as JS + Types, not as its own language with runtime features.