Skip to main content

Command Palette

Search for a command to run...

TypeScript Tutorial

Published
1 min readView as Markdown
M

Hi, I am Full Stack Developer. I can build web application, android application, desktop application. My core programming language is JavaScript.

Objects in Type Script

// type Obj = {
//     height: number;
//     weight: number;
//     gender?: boolean;
// }

interface Obj {
  height: number;
  weight: number;
  gender?: boolean;
}

type funcType = (n: number, m: number) => void;

interface NewObj extends Obj {
  scolar: boolean;
  func: funcType;
}

const gigi: NewObj = {
  height: 5222,
  weight: 2252,
  scolar: true,
  func: (n, m) => {
    console.log(m * n);
  },
};

const kendal: NewObj = {
  height: 552233,
  weight: 4455,
  scolar: true,
  func: (n, m) => {
    console.log(n * m);
  },
};

kendal.func(20, 40);

const obj: Obj = {
  height: 45,
  weight: 45,
  gender: true,
};

const obj3: Obj = {
  height: 5.2,
  weight: 52,
  gender: false,
};
2 views

More from this blog

promahbubul

63 posts

I'm React Native and Full Stack Web Deveioper. My core programming language is JavaScript.