@@ -1,4 +1,4 @@
-// Object
+// object (数组 对象 函数)
// Array 数组
// let a = [];
@@ -77,7 +77,8 @@ kk = {
}
console.log(kk.sex === Sex1.man ? '男' : '女');
-
+// type 声明的内容 更侧重于 类型的重复使用 支持联合类型和交叉类型
+// 联合类型
// 类型别名
type myType = string | number | boolean;
let ww:myType;
@@ -85,7 +86,17 @@ ww = 'hello';
ww = 123;
ww = true;
-// 联合类型 & 交叉类型
+type myType2 = {
+ name:string,
+ age:number
+}
+let zz:myType2;
+zz = {
+ name:'赵六',
+ age:22
+
+// & 交叉类型
let oo: {
name:string
} & {