From 9a7ed49cac954e2ee1d7d8850ac4fb6dc00c433e Mon Sep 17 00:00:00 2001 From: Norman Breau Date: Fri, 28 Jul 2023 15:43:55 -0300 Subject: [PATCH 1/2] test(ts): Added a TS compilation check --- package-lock.json | 16 +++++++++++++++- package.json | 8 +++++--- types/tests/index.ts | 4 ++++ types/tests/tsconfig.json | 11 +++++++++++ 4 files changed, 35 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 2c7fd087..2efc5c19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "8.1.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": { @@ -2588,6 +2589,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", diff --git a/package.json b/package.json index 63183bb9..2640663f 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 From 26d9cdbe7156cdd08d3227cee224a8e91256c422 Mon Sep 17 00:00:00 2001 From: Norman Breau Date: Wed, 7 Aug 2024 11:52:25 -0300 Subject: [PATCH 2/2] tsconfig/index.ts revisions --- types/tests/index.ts | 26 +++++++++++++++++++++++--- types/tests/tsconfig.json | 2 +- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/types/tests/index.ts b/types/tests/index.ts index 2a76d7af..61d7a11e 100644 --- a/types/tests/index.ts +++ b/types/tests/index.ts @@ -1,4 +1,24 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at -// Intentionally empty file, but -// further tests can be added to ensure type usages -// can work as expected + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +// Intentionally empty file to serve has an entry point to the TSC compiler. +// The tsconfig file also pulls in /index.d.ts which is the main thing being +// tested. + +// Additional code could be added to conduct further type testing. diff --git a/types/tests/tsconfig.json b/types/tests/tsconfig.json index 69c25bf6..054c766e 100644 --- a/types/tests/tsconfig.json +++ b/types/tests/tsconfig.json @@ -8,4 +8,4 @@ "include": [ "./*.ts" ] -} \ No newline at end of file +}