diff options
| author | Aiden Woodruff <aiden.woodruff@gmail.com> | 2021-06-30 21:19:13 -0500 |
|---|---|---|
| committer | Aiden Woodruff <aiden.woodruff@gmail.com> | 2021-06-30 21:19:13 -0500 |
| commit | f4a4f630e1d4992579cef54d9afcbc38ce727591 (patch) | |
| tree | e2600ea665744621465057375214ce5f0bb8d147 | |
| parent | 9568acf8f73fe0747c19cc2aa90b2f5d549c6b57 (diff) | |
| download | sweeper-typescript.tar.gz sweeper-typescript.tar.bz2 sweeper-typescript.zip | |
Stricter parsingtypescript
Make use of the fact that ES modules are always strict
- Make rules.ts a module in rules.html
Don't explicitly set "module"
| -rw-r--r-- | lib/leaders.ts | 2 | ||||
| -rw-r--r-- | lib/sweeper.ts | 2 | ||||
| -rw-r--r-- | lib/tsconfig.json | 3 | ||||
| -rw-r--r-- | rules.html | 2 | ||||
| -rw-r--r-- | tsconfig.json | 3 |
5 files changed, 5 insertions, 7 deletions
diff --git a/lib/leaders.ts b/lib/leaders.ts index 31b0643..321e4a4 100644 --- a/lib/leaders.ts +++ b/lib/leaders.ts | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | import { formatTime } from "./formatTime.js"; | 6 | import { formatTime } from "./formatTime.js"; |
| 7 | import type { Score } from "./score"; | 7 | import type { Score } from "./score"; |
| 8 | 8 | ||
| 9 | const $: typeof document.querySelector = document.querySelector.bind(document); | 9 | const $ = document.querySelector.bind(document); |
| 10 | 10 | ||
| 11 | document.addEventListener("DOMContentLoaded", () => { | 11 | document.addEventListener("DOMContentLoaded", () => { |
| 12 | let scores: Score[]; | 12 | let scores: Score[]; |
diff --git a/lib/sweeper.ts b/lib/sweeper.ts index f2118dd..4f54345 100644 --- a/lib/sweeper.ts +++ b/lib/sweeper.ts | |||
| @@ -221,7 +221,7 @@ function flag(event: MouseEvent): boolean { | |||
| 221 | * Send an XHR to ud_leaderboard.php file. | 221 | * Send an XHR to ud_leaderboard.php file. |
| 222 | */ | 222 | */ |
| 223 | function update_leaderboard() { | 223 | function update_leaderboard() { |
| 224 | score_entry.name = $("#name").value; | 224 | score_entry.name = ($("#name") as HTMLInputElement).value; |
| 225 | 225 | ||
| 226 | const replace_link = () => { | 226 | const replace_link = () => { |
| 227 | const ld = document.createElement("a"); | 227 | const ld = document.createElement("a"); |
diff --git a/lib/tsconfig.json b/lib/tsconfig.json index 04f9706..b05d9cc 100644 --- a/lib/tsconfig.json +++ b/lib/tsconfig.json | |||
| @@ -1,7 +1,4 @@ | |||
| 1 | { | 1 | { |
| 2 | "extends": "..", | 2 | "extends": "..", |
| 3 | "compilerOptions": { | ||
| 4 | "module": "ES2015" | ||
| 5 | }, | ||
| 6 | "include": [ "**/*.ts" ] | 3 | "include": [ "**/*.ts" ] |
| 7 | } | 4 | } |
| @@ -5,7 +5,7 @@ | |||
| 5 | <title>Rules of Minesweeper</title> | 5 | <title>Rules of Minesweeper</title> |
| 6 | <link type="image/png" rel="shortcut icon" href="images/favicon.png" /> | 6 | <link type="image/png" rel="shortcut icon" href="images/favicon.png" /> |
| 7 | <link rel="stylesheet" href="css/rules.css" /> | 7 | <link rel="stylesheet" href="css/rules.css" /> |
| 8 | <script type="application/javascript" src="lib/rules.js"></script> | 8 | <script type="module" src="lib/rules.js"></script> |
| 9 | </head> | 9 | </head> |
| 10 | <body> | 10 | <body> |
| 11 | <template id="example-1"> | 11 | <template id="example-1"> |
diff --git a/tsconfig.json b/tsconfig.json index 8594083..2ef7f39 100644 --- a/tsconfig.json +++ b/tsconfig.json | |||
| @@ -5,7 +5,8 @@ | |||
| 5 | "lib": [ "dom", "es2019" ], | 5 | "lib": [ "dom", "es2019" ], |
| 6 | "removeComments": true, | 6 | "removeComments": true, |
| 7 | "noEmitOnError": true, | 7 | "noEmitOnError": true, |
| 8 | "composite": true | 8 | "composite": true, |
| 9 | "strictBindCallApply": true, | ||
| 9 | }, | 10 | }, |
| 10 | "files": [], | 11 | "files": [], |
| 11 | "references": [ | 12 | "references": [ |
