zheng 3 semanas atrás
pai
commit
9207128b59

+ 0 - 1
15.ts/3.编译选项/demo.ts

@@ -1 +0,0 @@
-console.log("hello")

+ 2 - 1
15.ts/3.编译选项/index.html

@@ -6,6 +6,7 @@
     <title>Document</title>
 </head>
 <body>
-    
+    <script
+    src="./dist/app.js"></script>
 </body>
 </html>

+ 13 - 1
15.ts/3.编译选项/src/a1.ts

@@ -1,2 +1,14 @@
 let a3 = 12;
-console.log(a3);
+console.log(a3);
+// document.getElementById
+// document
+alert('hello ts');
+// let a4:any = 12;
+// let a4:any = 34;
+
+// let a4: number = 34;
+// a4 = 'str';
+// document.getElementById("app").innerHTML = "hello ts";
+let a4: number = 34;
+// a4 = 'ew';
+

+ 0 - 2
15.ts/3.编译选项/src/a2.ts

@@ -1,2 +0,0 @@
-let a3 = 12;
-console.log(a3);

+ 0 - 2
15.ts/3.编译选项/src/a3.ts

@@ -1,2 +0,0 @@
-let a3 = 12;
-console.log(a3);

+ 0 - 2
15.ts/3.编译选项/src/a4.ts

@@ -1,2 +0,0 @@
-let b3 = 12;
-console.log(b3);

+ 3 - 0
15.ts/3.编译选项/src/demo.js

@@ -0,0 +1,3 @@
+alert("demo")
+// let a32 = 12;
+// let a32 = 32;

+ 28 - 7
15.ts/3.编译选项/tsconfig.json

@@ -2,13 +2,13 @@
     // ** 任意文件夹
     // *  任意文件
     // 入口文件
-    // "include": [
-    //     "src/**/*"
-    // ],
-    // 出口文件
-    "exclude": [
-        "./src/**/*"
+    "include": [
+        "src/**/*"
     ],
+    // // 出口文件
+    // "exclude": [
+    //     "./src/**/*"
+    // ],
     // 继承
     // "extends": "./tsconfig.base.json",
     // 文件
@@ -21,6 +21,27 @@
     // ],
     // 编译选项
     "compilerOptions": {
-
+        // 指定的版本
+        // "es3", "es5", "es6", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "es2023", "es2024", "esnext"。
+        "target": "es6",
+        // 指定的模块
+        // "module": "system",
+        // 规定使用的库
+        "lib": ["dom"],
+        // 指定编译后的文件夹 具体放在哪个位置
+        "outDir": "./dist",
+        // 指定编译后的文件 具体放在哪个文件
+        // "outFile": "./dist/app.js",
+        // 允许编译js文件
+        // "allowJs": true,
+        // // 对js文件进行类型检查
+        // "checkJs": true,
+        // 注释是否编译
+        "removeComments": true,
+        // 不允许错误编译
+        // "noEmitOnError": true,
+        // 规定文件是否编译
+        "noEmit": true
+        
     }
 }