I am a newbie at TypeScript and after installing it successfully on my machine, I came across the sentence "Type annotations in TypeScript are lightweight ways to record the intended contract of the function or variable" in TypeScript's official documentation page.
What is the word contract explained in the context of a function or variable in TypeScript.
The example that I took a look at was:
function greeter(person: string){
return "Hello, " + person;
}
var user = "Jane User";
document.body.innerHTML=greeter(user);
Is it something to do with string annotation attached with the function variable person?
Any help on this is appreciated.
Here is the link to the official documentation