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..61d7a11e --- /dev/null +++ b/types/tests/index.ts @@ -0,0 +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 + + 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 new file mode 100644 index 00000000..054c766e --- /dev/null +++ b/types/tests/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "noEmit": true + }, + "files": [ + "../index.d.ts" + ], + "include": [ + "./*.ts" + ] +}