Це відео не доступне.
Перепрошуємо.

Catch Type Errors at Runtime with Zod: An Intro to this JavaScript Library

Поділитися
Вставка
  • Опубліковано 5 сер 2024
  • Zod is a runtime type checking library for JavaScript that can help you catch type errors before they cause problems in your code. In this tutorial, you'll learn how to use Zod to define strict schemas for your data and ensure that your variables always have the correct type at runtime. By following best practices for type safety, you can write more reliable and maintainable code.
    This tutorial covers the primary use case of Zod and some of the cool helper methods it has. By the end of the video, you'll have an understanding of how to start integrating it into your project and why it is growing in popularity.
    🐱 Repository for code in the video:
    github.com/Jimmydalecleveland...
    ~~~~~~
    00:00 - What is Zod and why is it gaining popularity?
    01:12 - Repo starting point quick walkthrough
    02:51 - Standard ways to Type a fetch result
    05:23 - Adding Zod to get runtime type checking
    08:33 - Zod parsed results error output
    10:03 - Fixing the error with Zod enforced actual fetch response
    11:51 - Zod validation methods
    15:08 - Transforming returned data with Zod
    16:35 - Wrap-up and thoughts
    ~~~~~~
    Follow Jimmy Cleveland's doings:
    twitter: / jimmydcleveland
    blog: blog.jimmydc.com/
    #typescript #zod

КОМЕНТАРІ • 30

  • @bhupenderkumar8615
    @bhupenderkumar8615 Рік тому

    Very nicely explained.☺️☺️☺️☺️

  • @tabliqatchi6696
    @tabliqatchi6696 Рік тому +2

    Just to be clearer for the beginners, the Person at 8:15 is not a type, it's schema. Although I know people sometimes call both types informally speaking. Nice tutorial, thanks.

  • @tobiasfedder1390
    @tobiasfedder1390 Рік тому +1

    That seems really cool and useful. Thanks for the introduction.

  • @MiadVosoughi
    @MiadVosoughi Рік тому +1

    good to see you're back

    • @SwashbucklingwithCode
      @SwashbucklingwithCode  Рік тому +2

      Thank you, it has been a good while. Had a crazy year, but I'm making an effort to get back to making videos consistently.

  • @hadimokhtari7839
    @hadimokhtari7839 Рік тому

    clean, enough and precise.
    Thanks.

  • @brod515
    @brod515 Рік тому +1

    Thanks man.
    the only thing I really cared about was gh pr status when I found out about the cli. didn't even know about that docs page.

    • @SwashbucklingwithCode
      @SwashbucklingwithCode  Рік тому

      Awesome. I think you might have commented on the wrong video, though.

    • @brod515
      @brod515 Рік тому

      @@SwashbucklingwithCode Wow I don't even know how that happened 😂

  • @heunsigjo7484
    @heunsigjo7484 Рік тому

    Thank you for the great tutorial video.

  • @GauravKumar-ue7nz
    @GauravKumar-ue7nz Рік тому

    You are awesome

  • @ademhodzic6712
    @ademhodzic6712 Рік тому +1

    Love the video. Keep up good work!

  • @rajiv-thoughtlessmind
    @rajiv-thoughtlessmind Рік тому

    I was waiting for this video since you created the repo yesterday

  • @michaelvigato3228
    @michaelvigato3228 Рік тому

    Super cool man, I really like your content. Honestly surprised you don't have 10x subs yet

    • @SwashbucklingwithCode
      @SwashbucklingwithCode  Рік тому +1

      Thank you, kindly. I am working on getting back to consistent creation this year so we'll see what happens.

  • @moneyfr
    @moneyfr Рік тому

    Arktype is great too

  • @user-wx7fg2dr9b
    @user-wx7fg2dr9b Рік тому

    Great content! and your voice sounds extremely good - do you mind sharing your recording setup?

    • @SwashbucklingwithCode
      @SwashbucklingwithCode  Рік тому

      Thanks, that's always nice to hear because I've put countless hours into my audio setup.
      On this video I have a Shure SM7b, running into a cloudlifter, into a dbx 286s pre-amp, into the focusrite scarlett 2i2 which goes to the computer.
      I use OBS to record, but I also use Screenflow at times.

  • @nickwoodward819
    @nickwoodward819 Рік тому

    @11:30 - So if I had data coming in and I made a schema and typed it, but then wanted to use that data in a UI component that showed a cut-down version I could created a different schema, parse the data, and it would transform it and check it at the same time? that's pretty cool

  • @mohammedabdelgawad4176
    @mohammedabdelgawad4176 Рік тому +1

    I heard you saying "no-demon" instead of "node-mon" or "node-monitor" and now I can't unlisten it 😂

    • @SwashbucklingwithCode
      @SwashbucklingwithCode  Рік тому

      indeed. github.com/remy/nodemon/blob/master/README.md#pronunciation

    • @mohammedabdelgawad4176
      @mohammedabdelgawad4176 Рік тому +1

      @@SwashbucklingwithCode I wasn't being offensive, it was just funny. I like your content, keep it up

    • @SwashbucklingwithCode
      @SwashbucklingwithCode  Рік тому +1

      @@mohammedabdelgawad4176 No worries, I didn't take it that way. I was just raising awareness that it is a very common debate.
      I actually used to pronounce it `node-mon`, and have heard the node-monitor argument. But you should check out the logo of the package and look up `daemon` if you aren't familiar with the term.

  • @sairaj5660
    @sairaj5660 Рік тому +3

    long time no see?

  • @johnnydriesen7575
    @johnnydriesen7575 Рік тому

    Wow, great help. Thanks.
    But what about MultiLanguage Apps ? (users can change the language of my App at runtime via a "language switcher... I'm using vue-i18n)
    At a certain moment, you're giving the hardcoded message 'films must be an array of valid strings' .
    In other words.... How can I make this "dynamic", based on the language my user has seletec in my app ?
    Any help or hint would be appreciated (a demo vid would even be better :) )
    Thanks in advance.

  • @KavehSaket
    @KavehSaket 10 місяців тому

    Please send this to DHH lol

  • @santiagosotelo9779
    @santiagosotelo9779 Рік тому

    Thank you patrick bateman!!!