> npm install -g typescript
const Greeter = (person) => {
return `Hello ${person}`
}
let user = "Pickle Rick"
document.body.innerHTML = Greeter(user);
var Greeter = function (person) {
return "Hello " + person;
};
var user = "Pickle Rick";
document.body.innerHTML = Greeter(user);
greeter.ts
greeter.js
const Greeter = (person:string) => {
return `Hello ${person}`
}
let user = [1,2,3]
document.body.innerHTML = Greeter(user);
error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'string'.