Skip to content

Commit 40ea101

Browse files
committed
Fix tsconfig settings for @reduxjs/toolkit
1 parent b5581f1 commit 40ea101

File tree

4 files changed

+17
-52
lines changed

4 files changed

+17
-52
lines changed

packages/toolkit/tsconfig.base.json

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,8 @@
11
{
2+
"extends": "@reduxjs/tsconfig/base",
23
"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
104
"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-
"types": ["vitest/globals", "vitest/importMeta"],
5+
"jsx": "react-jsx",
356
"paths": {
367
"@reduxjs/toolkit": ["./src/index.ts"], // @remap-prod-remove-line
378
"@reduxjs/toolkit/react": ["./src/react/index.ts"], // @remap-prod-remove-line

packages/toolkit/tsconfig.build.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
// For building the library.
33
"extends": "./tsconfig.base.json",
44
"compilerOptions": {
5-
"outDir": "dist"
5+
"emitDeclarationOnly": true,
6+
"jsx": "react",
7+
"outDir": "./dist",
8+
"rootDir": "./src"
69
},
7-
"include": ["src"],
810
"exclude": [
9-
"src/**/*.test.ts*",
1011
"src/**/*.test-d.ts*",
12+
"src/**/*.spec-d.ts*",
13+
"src/**/*.test.ts*",
1114
"src/**/*.spec.ts*",
12-
"src/**/tests/*",
13-
"src/**/*.typetest.ts*"
14-
]
15+
"src/**/tests/*"
16+
],
17+
"include": ["src"]
1518
}

packages/toolkit/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
// we are using during development.
55
"extends": "./tsconfig.test.json",
66
"compilerOptions": {
7-
"skipLibCheck": true,
8-
"rootDir": "."
7+
"allowJs": true,
8+
"checkJs": true,
9+
"rootDir": "./"
910
},
1011
"include": ["."]
1112
}

packages/toolkit/tsconfig.test.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
{
2-
// For runtime and type tests during CI.
2+
// For type tests during CI.
33
"extends": "./tsconfig.base.json",
44
"compilerOptions": {
5-
"emitDeclarationOnly": false,
65
"noEmit": true,
7-
"rootDir": "./src",
8-
"jsx": "react-jsx",
9-
"skipLibCheck": true,
10-
"noImplicitReturns": false
6+
"rootDir": "./src"
117
},
128
"exclude": ["dist"],
13-
"include": [
14-
"src/**/*.test.ts*",
15-
"src/**/*.test-d.ts*",
16-
"src/**/*.spec.ts*",
17-
"src/**/tests/**/*",
18-
"src/**/*.typetest.ts*"
19-
]
9+
"include": ["src/**/*.test-d.ts*", "src/**/*.spec-d.ts*"]
2010
}

0 commit comments

Comments
 (0)