zheng преди 1 ден
родител
ревизия
9eaa30c05b

+ 3 - 0
15.ts/3.编译选项/dist/a.js

@@ -0,0 +1,3 @@
+let s;
+s = 12;
+console.log(s, 's');

+ 14 - 0
15.ts/3.编译选项/dist/b.js

@@ -0,0 +1,14 @@
+let q;
+q = 90;
+console.log(q, 'q');
+const box = document.getElementById("box");
+box === null || box === void 0 ? void 0 : box.addEventListener("click", function () {
+    console.log("你好");
+});
+let a;
+a = 12;
+a = true;
+function fn1(a) {
+    return a + 1;
+}
+fn1(1);

+ 0 - 7
15.ts/3.编译选项/dist/news.js

@@ -1,7 +0,0 @@
-let s;
-s = 12;
-console.log(s, 's');
-// document.getElementById
-let q;
-q = 90;
-console.log(q, 'q');

+ 18 - 1
15.ts/3.编译选项/src/b.ts

@@ -1,3 +1,20 @@
 let q: number;
 q = 90;
-console.log(q, 'q')
+console.log(q, 'q')
+const box = document.getElementById("box");
+box?.addEventListener("click", function () {
+    console.log("你好")
+})
+// 你好我好 大家好
+let a: any;
+a = 12;
+a = true;
+
+
+function fn1(a) {
+    console.log(this)
+    return a + 1;
+
+}
+
+fn1(1)

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

@@ -0,0 +1,9 @@
+let yy = 11;
+console.log(yy);
+const obj = {
+    name: '12'
+}
+
+obj = {
+    name: "图图"
+}

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

@@ -10,12 +10,21 @@
     "compilerOptions": {
         // 指定ts编译成js的版本
         "target": "es2015",
-        "module": "system",
+        "module": "es2015",
         // lib规定可以使用什么库
         "lib": [
-            "DOM"
+            "DOM",
+            "ESNext"
         ],
         "outDir": "./dist",
-        "outFile": "./dist/news.js"
+        "allowJs": false,
+        "checkJs": false,
+        "removeComments": true,
+        // 严格模式
+        "strict": false,
+        // "noImplicitThis": true
+        // "noImplicitAny": false
+        // "alwaysStrict": true
+        "strictNullChecks": true
     }
 }