From the course: TypeScript for Node.js Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Adding types in your functions

Adding types in your functions

From the course: TypeScript for Node.js Developers

Start my 1-month free trial

Adding types in your functions

- [Instructor] The next step is to properly add types to your functions, which we have a few throughout our application. So let's go ahead and explore this. So the first thing you want to do, if you don't have it open, is open your index.ts. And then what we'll do is add a few variables that we'll leverage when we do the function. So the first one we'll do, let me just clean that up a little bit. I'll remove this, feel free to keep it in your own application, and then I'm going to add a few strings. So let's clean that up a little bit. I will remove the notes on this one, just to clean the application clean. And then let's remove the notes here. And then let's add a few variables. So the first one will be mlabUser, and we expect this one to be a string. And then we'll pass the mlabUser. So in this case, I'm going to copy linkedintest. And then let's create another variable, mlabPass, for password, which we also expect a string. And then I'm going to pass the password. And by the way…

Contents