Common Mistakes and Advanced Typescript Techniques

Поделиться
HTML-код
  • Опубликовано: 21 ноя 2024

Комментарии • 21

  • @SuperKidontheblock
    @SuperKidontheblock 8 месяцев назад +7

    Can you imagine having a large object with different fields being returned. Zod is heaven sent.

    • @LjupcheVasilev
      @LjupcheVasilev  8 месяцев назад +1

      100%! I don’t use it enough, I use AJV more, but I will be using it for my new side project.

    • @heavierthanlight7173
      @heavierthanlight7173 7 месяцев назад

      I just made the decision to use Zod inside Typescript projects after I read some really interesting articles on the net.

    • @LjupcheVasilev
      @LjupcheVasilev  7 месяцев назад

      Let us know how you're finding it after some time :)) @@heavierthanlight7173

    • @heavierthanlight7173
      @heavierthanlight7173 7 месяцев назад

      @@LjupcheVasilev will do!

  • @bradleyhill5312
    @bradleyhill5312 8 месяцев назад +2

    Really great rundown of useful tips for TypeScript! Thanks for the good work!

  • @iUmerFarooq
    @iUmerFarooq 8 месяцев назад +2

    Will you make course on typescript or Vuejs or Nuxtjs or NodeJs ExpressJs or Nestjs or Graphql?

    • @LjupcheVasilev
      @LjupcheVasilev  8 месяцев назад

      Probably not a whole course soon. But I will continue to make videos on those subjects.

  • @ivanlysko6677
    @ivanlysko6677 6 месяцев назад +2

    I've been trying to understand the distinctions between using types, enums, and const in TypeScript. Could you shed some light on how they differ and when to use each one?

    • @LjupcheVasilev
      @LjupcheVasilev  6 месяцев назад

      Types is a way to define what kind of values does the variable hold and it helps with type safety, catching issues while developing etc. For example `const status: string = 'active'`
      Enums are a way to define a set of named constants. For example when we have a variable of status and we know the status can be Active or Inactive only, that's when enums are most useful. Then these enums can be used to validate the input or whenever we need to use the status we can see which values it can be.
      Const is just a way to define a constant variable, same as in javascript. Constant means the value of the variable never changes. If the type is an array then we can mutate it like add/remove items but if we define a string we can't reassign it.
      Hope that helps.

  • @nimitsavant3127
    @nimitsavant3127 8 месяцев назад +1

    Very descriptive and informational thank you :)

  • @umaralifayzullayev
    @umaralifayzullayev 8 месяцев назад +1

    Wow this channel is so good 👍 👍 👍

  • @kalideb-y3y
    @kalideb-y3y 8 месяцев назад +1

    I think you don't need to check their types here 2:41 you already have defined types of it so TS will throw an error and you don't have to check it

    • @LjupcheVasilev
      @LjupcheVasilev  8 месяцев назад

      The reason why I’m checking the types there is because in my types they are set as required properties, but because they are input from the user we can’t be sure the user has actually sent all the required fields.
      I could’ve made the properties optional and then typescript will complain if they are not checked.

  • @morteza7298
    @morteza7298 7 месяцев назад +1

    Great video man, keep going

  • @manishgautam2424
    @manishgautam2424 7 месяцев назад +1

    That was great , You can deliver much better content , Keep it up