2.5Ts基础类型和对象类型

// 基础类型 null, undefined,symbol, boolean,void
const count: number = 1123;
const teachername: string = "ll";

// 对象类型
const teacher: {
  name: string,
  age: number,
} = {
  name: "ll",
  age: 14,
};
// 数组也属于对象类型
const numbers: number[] = [1, 2, 3];
// 类类型属于对象类型
class Person {}

const ll: Person = new Person();

// 函数类型属于对象类型
const getTotal: () => number = () => {
  return 123;
};

 

posted @ 2021-05-25 23:29  sinceForever  阅读(66)  评论(0编辑  收藏  举报