Skip to main content


Showing posts from October, 2014

Basic OOPS concept with TypeScript

Some time back I had written article on Introduction of TypeScript . We already know that OOPS concept can be used on JavaScript, but with TypeScript we can achieve in much simpler way. In this particular article we will check interaction of object in different way to handle HTML interaction situations in cleaner way with the help of objects and functions. We will check out by creating TS interface and passing it to some other function which will change some of the object properties and same can be communicated back to the source. I am trying to keep things simple only by using simple approach interface ICar { Model: string Speed: number; SpeedChange: (speed:number) => void; } Let's consume the above to other class which can be initialized be calling constructor. It is having simple method which is defining the SpeedChange body. class Main { constructor(private option: ICar) { option.SpeedChange = (speed) => { console.lo