Skip to content

Commit 252f7db

Browse files
fasttimeCopilot
andauthored
ci: add type tests for TypeScript 5.x to CI workflow (#230)
* ci: add type tests for TypeScript 5.x to CI workflow * Update tests/types/tsconfig.dist.json Co-authored-by: Copilot <[email protected]> * add npm scripts * apply suggestions from code review --------- Co-authored-by: Copilot <[email protected]>
1 parent 6e6ca05 commit 252f7db

5 files changed

Lines changed: 30 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ jobs:
6363
run: npm install
6464
- name: Check Types
6565
run: npm run test:types
66+
- name: Check Types (TypeScript 5.3)
67+
run: npm run test:types:5.3
68+
- name: Check Types (TypeScript 5.x)
69+
run: npm run test:types:5.x
6670
are_the_types_wrong:
6771
name: Are the types wrong?
6872
runs-on: ubuntu-latest

eslint.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ export default defineConfig([
107107
{
108108
name: "json/jsonc",
109109
plugins: { json },
110-
files: ["**/*.jsonc"],
110+
files: ["**/*.jsonc", "**/tsconfig*.json"],
111111
language: "json/jsonc",
112+
languageOptions: { allowTrailingCommas: true },
112113
extends: ["json/recommended"],
113114
},
114115
{

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@
5656
"test": "mocha \"tests/**/*.test.js\"",
5757
"test:coverage": "c8 npm test",
5858
"test:jsr": "npx -y jsr@latest publish --dry-run",
59-
"test:types": "tsc -p tests/types/tsconfig.json"
59+
"test:types": "tsc -p tests/types/tsconfig.json",
60+
"test:types:5.3": "npx -p [email protected] -y -- tsc -p tests/types/tsconfig.legacy.json",
61+
"test:types:5.x": "npx -p [email protected] -y -- tsc -p tests/types/tsconfig.json",
62+
"test:types:all": "npm run test:types && npm run test:types:5.x && npm run test:types:5.3"
6063
},
6164
"keywords": [
6265
"eslint",

tests/types/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4+
"allowJs": false,
5+
"checkJs": false,
46
"noEmit": true,
57
"rootDir": "../..",
68
"strict": true,
@@ -11,5 +13,5 @@
1113
"erasableSyntaxOnly": true
1214
},
1315
"files": [],
14-
"include": ["**/*.test.ts", "**/*.test.cts", "../../dist"]
16+
"include": [".", "../../dist"]
1517
}

tests/types/tsconfig.legacy.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"allowJs": false,
5+
"checkJs": false,
6+
"noEmit": true,
7+
"rootDir": "../..",
8+
"strict": true,
9+
"strictNullChecks": true,
10+
"useUnknownInCatchVariables": true,
11+
"exactOptionalPropertyTypes": true,
12+
"verbatimModuleSyntax": true
13+
// "erasableSyntaxOnly" is not supported in TypeScript < 5.8.
14+
},
15+
"files": [],
16+
"include": [".", "../../dist"]
17+
}

0 commit comments

Comments
 (0)