Skip to content

Commit 18e1296

Browse files
authored
test(types): add public type checks (#186)
1 parent 37ef0da commit 18e1296

File tree

6 files changed

+46
-2
lines changed

6 files changed

+46
-2
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
"lint": "rslint",
3030
"lint:write": "rslint --fix",
3131
"prettier:ci": "prettier --check .",
32-
"test": "pnpm run test:install && pnpm run build && rstest",
33-
"test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome"
32+
"test": "pnpm run test:install && pnpm run test:type && rstest",
33+
"test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome",
34+
"test:type": "pnpm run build && pnpm --dir tests run type-check"
3435
},
3536
"simple-git-hooks": {
3637
"pre-commit": "npx nano-staged"

tests/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "tests",
33
"private": true,
44
"type": "commonjs",
5+
"scripts": {
6+
"type-check": "pnpm exec tsc -p type-tests/resolution-bundler/tsconfig.json && pnpm exec tsc -p type-tests/resolution-nodenext/tsconfig.json"
7+
},
58
"devDependencies": {
69
"@module-federation/runtime-tools": "^2.1.0",
710
"@rspack/dev-server": "workspace:*"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This folder disables `skipLibCheck` to check the public types of @rspack/dev-server.
2+
import '@rspack/dev-server/client/index';
3+
import { RspackDevServer } from '@rspack/dev-server';
4+
import type { Configuration } from '@rspack/dev-server';
5+
6+
const config: Configuration = {};
7+
8+
void config;
9+
void RspackDevServer;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"module": "ES2022",
4+
"moduleResolution": "bundler",
5+
"target": "ES2023",
6+
"strict": true,
7+
"skipLibCheck": false,
8+
"noEmit": true
9+
},
10+
"include": ["index.ts"]
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This folder disables `skipLibCheck` to check the public types of @rspack/dev-server.
2+
import '@rspack/dev-server/client/index.js';
3+
import { RspackDevServer } from '@rspack/dev-server';
4+
import type { Configuration } from '@rspack/dev-server';
5+
6+
const config: Configuration = {};
7+
8+
void config;
9+
void RspackDevServer;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"module": "NodeNext",
4+
"moduleResolution": "NodeNext",
5+
"target": "ES2023",
6+
"strict": true,
7+
"skipLibCheck": false,
8+
"noEmit": true
9+
},
10+
"include": ["index.ts"]
11+
}

0 commit comments

Comments
 (0)