HZH-PC\HZH 3 years ago
parent
commit
82fe787792
3 changed files with 12 additions and 9 deletions
  1. 0 9
      01.ts
  2. 9 0
      part1/01.ts
  3. 3 0
      part1/02.ts

+ 0 - 9
01.ts

@@ -1,9 +0,0 @@
-let x: number = 1;
-let y = false;
-
-function sum(a: number,b: number): number{
-    return a + b;
-}
-
-let m: 10 | 22 | "ee";  //字面量
-let n: number | boolean;  //

+ 9 - 0
part1/01.ts

@@ -1,10 +1,19 @@
 let a: number;
 a = 4;
 
+function sum(a: number,b: number): number{
+    return a + b;
+}
+
+let x: number = 1;
+let y = false;
+
 // &表示同时
 let j: {name: string} & {age: number};
 j = {name: 'ddd',age: 33};
 
+let n: number | boolean;
+
 // 类型别名
 let k: 1 | 2 | 3;
 

+ 3 - 0
part1/02.ts

@@ -2,6 +2,9 @@
 // number string boolean 字面量 any void
 // unknown never object array tuple enum
 
+//字面量
+let xxx: 10 | 22 | "ee";  
+
 // 隐式类型any
 let d;
 d = 10;