From 12f46fcc16dbd9029d6a426bcaa657c96b2116d4 Mon Sep 17 00:00:00 2001 From: Norman Breau Date: Fri, 28 Jul 2023 15:43:55 -0300 Subject: [PATCH] test(ts): Added a TS compilation check --- package-lock.json | 22 +++++++++++++++++++++- package.json | 8 +++++--- types/tests/index.ts | 4 ++++ types/tests/tsconfig.json | 11 +++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 types/tests/index.ts create mode 100644 types/tests/tsconfig.json diff --git a/package-lock.json b/package-lock.json index 8aa5c043..fa67ec97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "8.0.1-dev", "license": "Apache-2.0", "devDependencies": { - "@cordova/eslint-config": "^5.0.0" + "@cordova/eslint-config": "^5.0.0", + "typescript": "^5.1.6" }, "engines": { "cordovaDependencies": { @@ -2224,6 +2225,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/typescript": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -3883,6 +3897,12 @@ "is-typed-array": "^1.1.9" } }, + "typescript": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "dev": true + }, "unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", diff --git a/package.json b/package.json index b5cbd29e..fe482542 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,9 @@ "cordova-windows" ], "scripts": { - "test": "npm run lint", - "lint": "eslint ." + "test": "npm run lint && npm run test:types", + "lint": "eslint .", + "test:types": "tsc --project ./types/tests/tsconfig.json" }, "author": "Apache Software Foundation", "license": "Apache-2.0", @@ -48,6 +49,7 @@ } }, "devDependencies": { - "@cordova/eslint-config": "^5.0.0" + "@cordova/eslint-config": "^5.0.0", + "typescript": "^5.1.6" } } diff --git a/types/tests/index.ts b/types/tests/index.ts new file mode 100644 index 00000000..2a76d7af --- /dev/null +++ b/types/tests/index.ts @@ -0,0 +1,4 @@ + +// Intentionally empty file, but +// further tests can be added to ensure type usages +// can work as expected diff --git a/types/tests/tsconfig.json b/types/tests/tsconfig.json new file mode 100644 index 00000000..69c25bf6 --- /dev/null +++ b/types/tests/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "noEmit": true + }, + "files": [ + "../index.d.ts" + ], + "include": [ + "./*.ts" + ] +} \ No newline at end of file