Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit 05f6123

Browse files
committed
tsconfig
1 parent 1ae8888 commit 05f6123

File tree

5 files changed

+66
-5
lines changed

5 files changed

+66
-5
lines changed

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ src
55
.prettierrc.json
66
eslint.config.js
77
jest.config.js
8-
tsconfig.json
8+
tsconfig.*.*

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"scripts": {
1414
"clean": "rimraf dist",
15-
"build": "yarn clean && tsc",
15+
"build": "yarn clean && tsc -p ./tsconfig.build.json",
1616
"test": "jest",
1717
"lint": "eslint . && tsc --noEmit",
1818
"lint:fix": "eslint . --fix",
@@ -35,6 +35,7 @@
3535
"@arktype/attest": "^0.7.0",
3636
"abitype": "^1.0.0",
3737
"ethers": "^6.11.1",
38+
"userop": "^0.4.0-beta.5",
3839
"viem": "^2.9.12"
3940
}
4041
}

tsconfig.base.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
// This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config.
3+
"include": [],
4+
"compilerOptions": {
5+
// Incremental builds
6+
// NOTE: Enabling incremental builds speeds up `tsc`. Keep in mind though that it does not reliably bust the cache when the `tsconfig.json` file changes.
7+
"incremental": false,
8+
9+
// Type checking
10+
"strict": true,
11+
"useDefineForClassFields": true, // Not enabled by default in `strict` mode unless we bump `target` to ES2022.
12+
"noFallthroughCasesInSwitch": true, // Not enabled by default in `strict` mode.
13+
"noImplicitReturns": true, // Not enabled by default in `strict` mode.
14+
"useUnknownInCatchVariables": true, // TODO: This would normally be enabled in `strict` mode but would require some adjustments to the codebase.
15+
"noImplicitOverride": true, // Not enabled by default in `strict` mode.
16+
"noUnusedLocals": true, // Not enabled by default in `strict` mode.
17+
"noUnusedParameters": true, // Not enabled by default in `strict` mode.
18+
// "exactOptionalPropertyTypes": true,
19+
// TODO: Uncomment and fix types.
20+
"declaration": true,
21+
// "noUncheckedIndexedAccess": true,
22+
23+
// JavaScript support
24+
"allowJs": false,
25+
"checkJs": false,
26+
27+
// Interop constraints
28+
"esModuleInterop": false,
29+
"allowSyntheticDefaultImports": false,
30+
"forceConsistentCasingInFileNames": true,
31+
"verbatimModuleSyntax": false,
32+
"importHelpers": true, // This is only used for build validation. Since we do not have `tslib` installed, this will fail if we accidentally make use of anything that'd require injection of helpers.
33+
34+
// Language and environment
35+
"moduleResolution": "Node",
36+
"module": "commonjs",
37+
"target": "ES2021", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping.
38+
"lib": [
39+
"ES2022", // By using ES2022 we get access to the `.cause` property on `Error` instances.
40+
"DOM" // We are adding `DOM` here to get the `fetch`, etc. types. This should be removed once these types are available via DefinitelyTyped.
41+
],
42+
43+
// Skip type checking for node modules
44+
"skipLibCheck": true
45+
}
46+
}

tsconfig.build.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
// This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files.
3+
"extends": "./tsconfig.base.json",
4+
5+
"include": ["src"],
6+
"exclude": ["dist", "src/test", "node_modules"],
7+
"compilerOptions": {
8+
"moduleResolution": "Node",
9+
"sourceMap": true,
10+
"outDir": "./dist",
11+
"rootDir": "./src"
12+
}
13+
}

tsconfig.json renamed to tsconfig.extension.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
14+
"target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
@@ -98,8 +98,9 @@
9898

9999
/* Completeness */
100100
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
101-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
101+
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
102+
"sourceMap": true
102103
},
103104
"include": ["src"],
104-
"exclude": ["dist", "src/test", "node_modules"]
105+
"exclude": ["dist", "src/test", "node_modules"],
105106
}

0 commit comments

Comments
 (0)