diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73ca501..261717b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,6 +63,10 @@ jobs: run: npm install - name: Check Types run: npm run test:types + - name: Check Types (TypeScript 5.3) + run: npm run test:types:5.3 + - name: Check Types (TypeScript 5.x) + run: npm run test:types:5.x are_the_types_wrong: name: Are the types wrong? runs-on: ubuntu-latest diff --git a/eslint.config.js b/eslint.config.js index c67cef8..a77f92d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -107,8 +107,9 @@ export default defineConfig([ { name: "json/jsonc", plugins: { json }, - files: ["**/*.jsonc"], + files: ["**/*.jsonc", "**/tsconfig*.json"], language: "json/jsonc", + languageOptions: { allowTrailingCommas: true }, extends: ["json/recommended"], }, { diff --git a/package.json b/package.json index 9faf239..4cae3e4 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,10 @@ "test": "mocha \"tests/**/*.test.js\"", "test:coverage": "c8 npm test", "test:jsr": "npx -y jsr@latest publish --dry-run", - "test:types": "tsc -p tests/types/tsconfig.json" + "test:types": "tsc -p tests/types/tsconfig.json", + "test:types:5.3": "npx -p typescript@5.3 -y -- tsc -p tests/types/tsconfig.legacy.json", + "test:types:5.x": "npx -p typescript@5.x -y -- tsc -p tests/types/tsconfig.json", + "test:types:all": "npm run test:types && npm run test:types:5.x && npm run test:types:5.3" }, "keywords": [ "eslint", diff --git a/tests/types/tsconfig.json b/tests/types/tsconfig.json index 14eb608..94376db 100644 --- a/tests/types/tsconfig.json +++ b/tests/types/tsconfig.json @@ -1,6 +1,8 @@ { "extends": "../../tsconfig.json", "compilerOptions": { + "allowJs": false, + "checkJs": false, "noEmit": true, "rootDir": "../..", "strict": true, @@ -11,5 +13,5 @@ "erasableSyntaxOnly": true }, "files": [], - "include": ["**/*.test.ts", "**/*.test.cts", "../../dist"] + "include": [".", "../../dist"] } diff --git a/tests/types/tsconfig.legacy.json b/tests/types/tsconfig.legacy.json new file mode 100644 index 0000000..11f712e --- /dev/null +++ b/tests/types/tsconfig.legacy.json @@ -0,0 +1,17 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "allowJs": false, + "checkJs": false, + "noEmit": true, + "rootDir": "../..", + "strict": true, + "strictNullChecks": true, + "useUnknownInCatchVariables": true, + "exactOptionalPropertyTypes": true, + "verbatimModuleSyntax": true + // "erasableSyntaxOnly" is not supported in TypeScript < 5.8. + }, + "files": [], + "include": [".", "../../dist"] +}