In this article we will learn about some of the frequently asked TypeScript programming questions in technical like “arrow function in typescript” Code Answer’s. When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks. Error or stack handling on typescript was simple and easy. An error message with filename, line number and a message describing the error is sent to the browser. This tutorial contains some of the most common error checking methods in Typescript. Below are some solution about “arrow function in typescript” Code Answer’s.
generic arrow function typescript
xxxxxxxxxx
1
const foo = <T extends unknown>(x: T) => x;
arrow function in typescript
xxxxxxxxxx
1
//prototype
2
const/let <FunctionName> = (params: type) :<ReturnType> =>{
3
.
4
};
5
6
const PrintName = (name: string): string => {
7
return console.log("my name is " , name) ;
8
}
typescript arrow function
xxxxxxxxxx
1
let sum = (x: number, y: number): number => {
2
return x + y;
3
}
4
5
sum(10, 20); //returns 30
arrow function in ts
xxxxxxxxxx
1
// ES6: With arrow function
2
var getResult = (username: string, points: number): string => {
3
return `${ username } scored ${ points } points!`;
4
};
5
6
getResult('joyous jackal' , 100);