Skip to content

Commit dafc01e

Browse files
committed
Type check with Typescript compiler
1 parent 33411c3 commit dafc01e

File tree

6 files changed

+47
-2
lines changed

6 files changed

+47
-2
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ jobs:
5252
- run: npm run lint .
5353
name: Lint
5454
if: matrix.runner == 'ubuntu-latest'
55+
- run: npm run typecheck
56+
name: Type check
57+
if: matrix.runner == 'ubuntu-latest'
5558
- run: |
5659
set -euo pipefail
5760
sudo apt-get update

install.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ function getRequestOptions(downloadPath) {
247247
*/
248248
async function getChromeDriverVersion(requestOptions) {
249249
console.log('Finding Chromedriver version.');
250+
// @ts-expect-error
250251
const response = await axios.request(requestOptions);
251252
chromedriver_version = response.data.trim();
252253
console.log(`Chromedriver version is ${chromedriver_version}.`);
@@ -261,6 +262,7 @@ async function requestBinary(requestOptions, filePath) {
261262
const outFile = fs.createWriteStream(filePath);
262263
let response;
263264
try {
265+
// @ts-expect-error
264266
response = await axios.request({ responseType: 'stream', ...requestOptions });
265267
} catch (error) {
266268
if (error && error.response) {

package-lock.json

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"scripts": {
2525
"install": "node install.js",
2626
"update-chromedriver": "node update.js",
27+
"typecheck": "tsc",
2728
"lint": "eslint"
2829
},
2930
"dependencies": {
@@ -36,7 +37,8 @@
3637
"tcp-port-used": "^1.0.1"
3738
},
3839
"devDependencies": {
39-
"eslint": "^8.26.0"
40+
"eslint": "^8.26.0",
41+
"typescript": "^4.8.4"
4042
},
4143
"engines": {
4244
"node": ">=10"

tsconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "ES2020",
5+
"sourceMap": false,
6+
"allowJs": true,
7+
"checkJs": true,
8+
"skipLibCheck": true,
9+
"noEmit": true
10+
},
11+
"include": [
12+
"**/*.js"
13+
],
14+
"exclude": [
15+
"node_modules"
16+
]
17+
}

update.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const CURRENT_VERSION = require('./lib/chromedriver').version;
99
async function getLatest() {
1010
const requestOptions = { url: 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE', method: "GET" };
1111
try {
12+
// @ts-expect-error
1213
const response = await axios(requestOptions);
1314
return response.data.trim();
1415
} catch (err) {

0 commit comments

Comments
 (0)