Skip to content

Commit 70481af

Browse files
committed
Revamp type tests config
1 parent e2484ef commit 70481af

File tree

5 files changed

+57
-38
lines changed

5 files changed

+57
-38
lines changed

test/typetests/tsconfig.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

tsconfig.base.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ESnext",
4+
"module": "ESnext",
5+
"lib": ["DOM", "ESNext"],
6+
"importHelpers": true,
7+
// output .d.ts declaration files for consumers
8+
"declaration": true,
9+
// match output dir to input dir. e.g. dist/index instead of dist/src/index
10+
"rootDir": "./src",
11+
// stricter type-checking for stronger correctness. Recommended by TS
12+
"strict": true,
13+
// linter checks for common issues
14+
"noImplicitReturns": true,
15+
"noFallthroughCasesInSwitch": true,
16+
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
17+
"noUnusedLocals": false,
18+
"noUnusedParameters": false,
19+
// use Node's module resolution algorithm, instead of the legacy TS one
20+
"moduleResolution": "Node",
21+
// transpile JSX to React.createElement
22+
"jsx": "react",
23+
// interop between ESM and CJS modules. Recommended by TS
24+
"esModuleInterop": true,
25+
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
26+
"skipLibCheck": true,
27+
// error out if import and file system have a casing mismatch. Recommended by TS
28+
"forceConsistentCasingInFileNames": true,
29+
// ensure that each file can be safely transpiled by babel (etc.) without relying on other imports
30+
"isolatedModules": true,
31+
"downlevelIteration": false,
32+
"allowSyntheticDefaultImports": true,
33+
"emitDeclarationOnly": true,
34+
"noErrorTruncation": true,
35+
"types": ["vitest/globals", "vitest/importMeta"]
36+
},
37+
"exclude": ["dist", "website", "docs", "examples"]
38+
}

tsconfig.build.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
// For building the library.
3+
"extends": "./tsconfig.base.json",
4+
"compilerOptions": {
5+
"outDir": "dist"
6+
},
7+
"include": ["src"]
8+
}

tsconfig.json

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
11
{
2+
// For general development and intellisense.
3+
// Scans the entire source code against the current TS version
4+
// we are using during development.
5+
"extends": "./tsconfig.test.json",
26
"compilerOptions": {
3-
"strict": true,
4-
"target": "ESNext",
5-
"module": "ESNext",
6-
"moduleResolution": "Node",
7-
"esModuleInterop": true,
8-
"skipLibCheck": true,
9-
"allowJs": true,
10-
"jsx": "react",
11-
"declaration": true,
12-
"emitDeclarationOnly": true,
13-
"outDir": "dist",
14-
"forceConsistentCasingInFileNames": true,
15-
"experimentalDecorators": true,
16-
"rootDirs": ["./src", "./types"],
17-
"baseUrl": ".",
18-
"rootDir": ".",
19-
"types": ["vitest/globals", "vitest/importMeta"]
7+
"allowJs": true
208
},
21-
"exclude": ["node_modules", "dist", "test/**/*"]
9+
"include": ["."],
2210
}

tsconfig.test.json

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
{
2-
"extends": "../tsconfig.json",
2+
// For runtime and type tests during CI.
3+
"extends": "./tsconfig.base.json",
34
"compilerOptions": {
4-
"allowSyntheticDefaultImports": true,
5-
"esModuleInterop": true,
6-
"module": "esnext",
7-
"moduleResolution": "node",
85
"emitDeclarationOnly": false,
9-
"declaration": false,
10-
"strict": true,
116
"noEmit": true,
12-
"target": "es2018",
7+
"rootDir": ".",
138
"jsx": "react-jsx",
14-
"baseUrl": ".",
15-
"skipLibCheck": true,
16-
"noImplicitReturns": false,
17-
"experimentalDecorators": true
9+
"noImplicitReturns": false
1810
},
19-
"exclude": []
11+
// "include": ["type-tests"]
2012
}

0 commit comments

Comments
 (0)