In this lesson, we're going to learn how to use types in TypeScript
I have talked briefly about types in TypeScript in the second module. In this lesson, we will use them practically. Open the project, and run npm start. We see nothing because there is no
app.js file yet. Let's write our code inside
I am a string; and finally a boolean, bool, and give it a value, true.
TypeScript has a property called inference which is the ability to infer the data type. Now that we have assigned values to our constants, there is no need to give them a type explicitly; although, we can do that, but it will be overkill to do so. However, let's say it was let rather than const and we needed to change the value; let's change const to let. Now, if we hover over num, it has inferred the data type, number. If we try to give it a value string, it gives us an error and it says, Type
string is not assignable to type