Interface in TypeScript || Interface along with Arrow Function

In this video,I explained interface in TypeScript. Feel free to comment. For more, please subscribe and press the BELL icon. Please visit my Angular Playlist .Please visit my YouTube Videos. The code is as follows -

interface.ts -
interface Chat {   // Chat is the interface name
  x: number,
  y: number
}

let doChat = (chat: Chat) => {  // doChat - arrow function
  console.log("The value of x:- " + chat.x);          // chat - parameter
  console.log("The value of y:- " + chat.y);
}

doChat({
  x: 20,
  y: 40
})

interface1.ts - 
interface anik {
  x: number,
  y: number
}


let singh = (abc: anik) => {
  console.log(abc.x);
  console.log(abc.y);
}

singh({
  x: 1,
  y: 2
})


Comments

Popular posts from this blog

CSS - Inline Type in CSS

Simple Program Using TypeScript || Program in TypeScript