Using Typescript in Node.js

Поділитися
Вставка
  • Опубліковано 2 жов 2024

КОМЕНТАРІ • 112

  • @zokalyx
    @zokalyx 3 роки тому +58

    I've never been so excited for getting more squiggly red lines

    • @otisbraxton4653
      @otisbraxton4653 3 роки тому

      I know im asking the wrong place but does any of you know of a way to log back into an Instagram account??
      I stupidly forgot my password. I appreciate any assistance you can offer me!

    • @tysondaniel2419
      @tysondaniel2419 3 роки тому

      @Otis Braxton instablaster =)

  • @DuraanAli
    @DuraanAli 4 роки тому +60

    4:26 "No demon is ganna watch our files" lol

  • @uran1980video
    @uran1980video 5 років тому +37

    Hi, Ben. Greate video! Please, do more videos for practical usage of typescript in regular projects. Thanks a lot

    • @bawad
      @bawad  5 років тому +9

      Sure

  • @srinivasvalekar9904
    @srinivasvalekar9904 4 роки тому +3

    9:36 saved days of restarting visual code for me. Thanks Ben. Subscribed and bookmarked this video.

    • @bawad
      @bawad  4 роки тому +1

      Welcome :) you might also like my vscode tips video: benawad.com/vscode

  • @illya_ike
    @illya_ike 3 роки тому +12

    it is good to know that you can escape type limitations with type any, but it is better not to show this trick to juniors )) as they will use any way too much, turning typescript code into JavaScript defeating the purpose.

  • @craigjohnson8279
    @craigjohnson8279 5 років тому +18

    Great video Ben! I'm glad that you did this from scratch. That way we can code along.

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

    Amazing video! Really helped me understand typescript a lot better.

  • @mahendraverma3459
    @mahendraverma3459 2 роки тому +1

    Hi Ben, This is a great tutorial for starting to work on node. I will appreciate if you could make a video to use the same code (library) in browser and as well as in server.

  • @maxiequa567
    @maxiequa567 5 років тому +8

    Awesome introduction to the subject Ben, your enthusiasm for TS is also highly motivating, thanks.

  • @barnabaskalydy6260
    @barnabaskalydy6260 2 роки тому

    Great video, thank you!

  • @elEntrampe
    @elEntrampe 4 роки тому

    Its like magic ! thanks for the videos!

  • @keivansf3459
    @keivansf3459 2 роки тому

    Thanks for this

  • @RoyerAdames
    @RoyerAdames 3 роки тому

    You make great videos

  • @akovn107
    @akovn107 2 роки тому +2

    Hi Ben. thanks for your great tutorial, I wonder how do you get those auto suggestions on terminal? what should I use to get that? I'm on Linux by the way.

  • @itsdavidmora
    @itsdavidmora 4 роки тому

    So helpful!

  • @Voldeblort
    @Voldeblort 2 роки тому

    13:12
    "... when you know your code is right."
    So never 🤣🤣

  • @nikoszervo
    @nikoszervo 3 роки тому

    watch this at 2x speed. In 10 minutes I learned quite a lot of stuff!!!

  • @dhidhi1000
    @dhidhi1000 2 роки тому

    "An async function or method in ES5/ES3 requires the 'Promise' constructor"
    Cannot create a simple demo without running into errors in the first 10 seconds, typescript is very nice

  • @zlatkoiliev8927
    @zlatkoiliev8927 2 роки тому +1

    Hey Ben, really good stuff! I wasted so much time wondering how can I attach new prop to the req object and still make typescript happy. I have one issue with casting it to any, when I am trying to catch the user in a middleware I will have to cats req to any on that place too. Is there any way I can maybe extend the namespace or extend the type and use it globally instead?!? I wish I have the type definitions for req and just add the props I need.

  • @oussamasethoum2755
    @oussamasethoum2755 4 роки тому

    Thank You ❤

  • @RafaelMendes-yw2jm
    @RafaelMendes-yw2jm Рік тому

    Why you never import any file, is that the way you program things? sounds very spaghetti!

  • @hamzehhanandeh3647
    @hamzehhanandeh3647 3 роки тому +1

    Thank you

  • @undonejs
    @undonejs 4 роки тому +1

    Thanks Ben! Your video is really cool, and you type code so fast! It seems that you used vscode + vim, right?Could you please tell me how to config that? or what things should I learn?

    • @bawad
      @bawad  4 роки тому +2

      yeah:
      benawad.com/vim
      benawad.com/vscode

  • @treezc8136
    @treezc8136 3 роки тому

    Thanks alogototltltlgglgltltototototoyotoyototottototototoooooo love you ben :)

  • @inanbunyamin
    @inanbunyamin 3 роки тому

    Thank you for the video. Would you please tell me which bash you are using in your vscode terminal?

  • @TheLondekZdroj
    @TheLondekZdroj 5 років тому +1

    Very amusing video, looks like you're reading somebody else's examples not quite understanding what's what. :D

    • @ethancollins5807
      @ethancollins5807 4 роки тому +2

      Why watch a tutorial if you feel like you’re above it? Not gonna get far in the tech community if you belittle others.

  • @soulninjadev
    @soulninjadev 2 роки тому

    how does he not have a node_modules folder

  • @simopr09
    @simopr09 4 роки тому +1

    Thanks Ben! great tutorial. Definitely subscribing! keep up the good work

  • @stxnw
    @stxnw 2 роки тому

    as of now, ts-node-dev doesn't work on the latest version of TS

  • @Luxcium
    @Luxcium 5 років тому +1

    Can you review my TypeScript VsCode theme of colour and syntax coloring ?? Pop N’ Loc Theme by Luxcium in the extention store

    • @bawad
      @bawad  5 років тому +1

      looks pretty good

    • @Luxcium
      @Luxcium 5 років тому

      Ben Awad too many hours in the development of that theme I cannot believe les than 6 months later 5000 person using it !!!

  •  5 років тому +1

    I noticed that people are very often confused about interface vs type so i recently published a whole article just about this: pawelgrzybek.com/typescript-interface-vs-type/
    Great vide o Ben as always. Keep on doing an amazing work!

    • @kps2642
      @kps2642 5 років тому +1

      woah awesome read, thanks

  • @pranjalagnihotri6072
    @pranjalagnihotri6072 3 роки тому

    ts-node does not work with path aliases

  • @SpooningTreesap86
    @SpooningTreesap86 2 роки тому

    How do you get color coded intellisense hints like at 6:00 such as the function keyword being blue, params a lighter blue with types as green etc? My intellisense hints are just white or grey

  • @BuildWithAITools
    @BuildWithAITools 5 років тому +4

    The best intro to typescript.

    • @bawad
      @bawad  5 років тому

      thanks!

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

    thx for share this content! =D

  • @bhaveshkumar9995
    @bhaveshkumar9995 5 років тому

    Hi Ben,
    with this tsconfig : github.com/benawad/node-ts-graphql-boilerplate/blob/master/tsconfig.json
    It is working fine with ts-node-dev --respawn src/index.ts command
    When I do build using tsc -w -p ./tsconfig.json and run node file under dist folder it is giving me error
    (function (exports, require, module, __filename, __dirname) { import { Field, ID, ObjectType } from "type-graphql";
    ^
    SyntaxError: Unexpected token {
    Any idea?

  • @haiderimam8977
    @haiderimam8977 3 роки тому

    5:52 how did the dropdown appear?? also can we somehow see the dropdown even if we aren't destructuring?

  • @milon27
    @milon27 2 роки тому

    how to deploy it

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

    just explained what i was wondering about. thanks, Ben.

  • @talhakhan3010
    @talhakhan3010 2 роки тому

    hey ben, this is a very concise video.. thank u very much... :)

  • @thangphan6047
    @thangphan6047 2 роки тому

    Thank you so much.

  • @RafiqueMohammed
    @RafiqueMohammed 3 роки тому

    Subscribed rightaway! Please upload more video and also cover nodejs without using express! Awesome tutorial !!

  • @adriannlara
    @adriannlara 5 років тому +1

    with Vim extension you can G + D to go to definition

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

    Cool stuff!

  • @АлександрКот-ъ9х
    @АлександрКот-ъ9х 4 роки тому +1

    How to debug ts?

  • @akashshrestha01
    @akashshrestha01 3 роки тому

    great
    more videos on ts + node plz

  • @gabrielaugusto6001
    @gabrielaugusto6001 2 роки тому

    oh dude, thank u so much for this video!

  • @juancamiloq1
    @juancamiloq1 5 років тому +1

    Awesome video as always Ben.

  • @piyushaggarwal5207
    @piyushaggarwal5207 2 роки тому

    No Demon 😆

  • @bronze_painter
    @bronze_painter 4 роки тому

    Super informative. Thank you for doing this! Subscribed!

  • @Yo-yx8wo
    @Yo-yx8wo 3 роки тому

    wow, amazing video, all the we need in just one place, thank you so much

  • @andrewsabato6887
    @andrewsabato6887 4 роки тому

    That code looks disgusting. You job now on is to fix typescript errors, yeah no thanks.

  • @yeicore
    @yeicore 4 роки тому

    Node but it's Deno

  • @obinna_okechukwu
    @obinna_okechukwu 5 років тому

    Thanks for the video. What's your suggestion of a workflow for development and deployment of a TypeScript node application. Say for instance a GraphQL server written in TypeScript. Do I build, then upload the build to the server or upload the ts files to the server and then build there is some other elegant continous integration workflow. Thanks in advance.

    • @bawad
      @bawad  5 років тому

      depends what your using to host your project
      sounds like you may be using a vps. For that you can just build your code locally and upload it to the vps

    • @obinna_okechukwu
      @obinna_okechukwu 5 років тому

      @@bawad yea, I use a vps. Thanks for your suggestion. Appreciate!

  • @bhavinpatil8020
    @bhavinpatil8020 3 роки тому

    Brilliant it helped me in my work thanks!

  • @zik9326
    @zik9326 3 роки тому

    Great, it help me a lot. Thanks Ben!

  • @rocktonicy7688
    @rocktonicy7688 3 роки тому

    very useful Thanks

  • @shijinnath9065
    @shijinnath9065 4 роки тому

    Awesome video. Thank you for doing the video

  • @arkadiuszcholewa5617
    @arkadiuszcholewa5617 5 років тому +1

    Hi! How you set up fish terminal in VS Code?

    • @bawad
      @bawad  5 років тому

      gist.github.com/benawad/1e9dd01994f78489306fbfd6f7b01cd3#file-settings-json-L50

    • @arkadiuszcholewa5617
      @arkadiuszcholewa5617 5 років тому

      @@bawad Thank you! :)

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

    says this is for beginners, proceeds to use 'yarn'...

  • @taylorcantwell7973
    @taylorcantwell7973 3 роки тому

    excellent scontent chap

  • @JurajPecháč
    @JurajPecháč 5 років тому

    Difference between tsc --init and npx tsc --init?

    • @devianllert8192
      @devianllert8192 5 років тому +1

      Npx installs a dependency, executes and then deletes

  • @flodemonnn
    @flodemonnn 4 роки тому

    How are you getting color in the "Read more" pop-up from Intellisense ? 6:38 ?

    • @bawad
      @bawad  4 роки тому

      I'm not sure, I don't remember turning on a setting for it just always been like that

  • @RehanKhan-xf3ml
    @RehanKhan-xf3ml 2 роки тому

    What do you use for terminal auto complete

    • @ericsmith9293
      @ericsmith9293 2 роки тому

      Z shell + autosuggestions plugin or fish

  • @zindev
    @zindev 4 роки тому

    Hey Ben, as you type here at 10:09 the intellisense automatically show up telling you the types. How you'd set that?

    • @bawad
      @bawad  4 роки тому +1

      benawad.com/vscode

  • @MaxPicAxe
    @MaxPicAxe 5 років тому

    I agree with using interface for objects

  • @Steve-Richter
    @Steve-Richter 4 роки тому

    How does downstream code in express know that middleware has added properties to the request object?

    • @bawad
      @bawad  4 роки тому

      I usually do an if statement

  • @husreihn1070
    @husreihn1070 5 років тому

    What do you use for cli, your cli hints you what you are going to type next... Can i use this in windows as well? whats the name of that cli? or plugin

    • @bawad
      @bawad  5 років тому

      fishshell.com/

  • @vaibhavm1986
    @vaibhavm1986 4 роки тому

    Very informative

  • @neociber24
    @neociber24 3 роки тому +1

    People that write entire projects in JS are absolute madman.

  • @Steve-Richter
    @Steve-Richter 4 роки тому

    Why use yarn instead of npm? Any advantages?

    • @bawad
      @bawad  4 роки тому

      seems to be faster for me

  • @kid_kulafu_1727
    @kid_kulafu_1727 4 роки тому

    youre my hero!

  • @Max-xp3tf
    @Max-xp3tf 3 роки тому

    Noice

  • @mma.madallangusstawmmasill2403
    @mma.madallangusstawmmasill2403 4 роки тому

    Gusttaw mmä

  • @jacoblee6230
    @jacoblee6230 5 років тому

    4:17 Anyone know how he removed code inside double quote ?

    • @bawad
      @bawad  5 років тому

      vim hotkey: ct"
      ua-cam.com/video/IiwGbcd8S7I/v-deo.html

    • @rohanbansal3099
      @rohanbansal3099 4 роки тому

      An alternative that lets you place your cursor anywhere in the double quotations (and not just the first character) is `di"`. Also works for brackets, curly braces, parentheses etc.

  • @rizaanjappie
    @rizaanjappie 4 роки тому

    Or you could use asp.net core webapi

  • @krasen4oo
    @krasen4oo 5 років тому

    So much time spent on casting as any, ts-ignore, and avoiding the type errors. Learning to use types correctly is much more valuable.

  • @yuriihusak1959
    @yuriihusak1959 4 роки тому +6

    13:15 you are not right! you are mutating req object, that is why you have this behaviour. req and res are object which provide you their API to use , do not user them as some kind of containers for you random props.
    14:58 - just set with default value (a: number, b: number = 0) and stop making this mess

    • @MAC0071234
      @MAC0071234 3 роки тому +1

      Exactly!! Thank You.
      I see it so often, that the people who are so stuck up and vocal about "Typescript" are the ones who can't code properly even the simple stuff. And I am like, "oh now I understand, why they say that typescript helps them catch so many silly errors". And by the like to dislike ratio you can tell that there are probably 18 people as of now who know how to code.
      Typescript is great but if you don't know how to code, then you are going to make more errors than a person who knows how to code will ever make in javascript or any other language.

    • @chetan9533
      @chetan9533 2 роки тому

      but middlewares often do need to attach a property to request object so info can be passed onto next call. what's the correct way to handle that?

    • @yuriihusak1959
      @yuriihusak1959 2 роки тому +1

      @@chetan9533 that is the right observation and questions!
      1) think of how to wrap middlewares with a function that provides an additional argument which can be used for storing the data
      2) think of having a global (within the file) Map object where keys are req objects and values are the extra data. Of course in this case you have to think how to clean up data in the end, but that shouldn't be difficult

    • @yuriihusak1959
      @yuriihusak1959 2 роки тому +1

      @@chetan9533 there are more approaches you can think of

  • @theacid1
    @theacid1 3 роки тому

    What the heck is yarn