@codecompose/typescript-config 2.3.0 → 3.0.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -5
- package/package.json +11 -3
- package/src/base.json +0 -4
package/README.md
CHANGED
|
@@ -4,14 +4,17 @@ Opinionated and reusable Typescript configurations, geared towards modern build
|
|
|
4
4
|
|
|
5
5
|
- Only use the Typescript compiler for type-checking (*)
|
|
6
6
|
- Use your bundler to output code, sourcemaps, and type declarations where needed.
|
|
7
|
-
-
|
|
7
|
+
- Requires TypeScript 6.0 or later
|
|
8
|
+
- Builds on TS6 strict defaults with additional strictness: `noUncheckedIndexedAccess`, `noImplicitOverride`, and `erasableSyntaxOnly`
|
|
8
9
|
- Assume `src` and `dist` directories
|
|
9
10
|
- Use of `~/` or `@/` as path alias for `src`
|
|
10
|
-
-
|
|
11
|
+
- Uses `${configDir}` to remove all client configuration
|
|
11
12
|
|
|
12
13
|
(*) Project references / shared monorepo packages also emit code.
|
|
13
14
|
|
|
14
|
-
To use this successfully, you would need a modern bundler like [tsdown](https://tsdown.dev/). You can check out the [
|
|
15
|
+
To use this successfully, you would need a modern bundler like [tsdown](https://tsdown.dev/). You can check out the [typescript-monorepo](https://github.com/0x80/typescript-monorepo) boilerplate for a working example of a modern monorepo setup with tsdown.
|
|
16
|
+
|
|
17
|
+
These configurations are also compatible with [TSGo](https://github.com/nicksrandall/tsgo), the native Go port of the TypeScript compiler.
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
## Install
|
|
@@ -71,9 +74,37 @@ If you publish your package, it is recommended to include the Typescript source
|
|
|
71
74
|
|
|
72
75
|
To export source files next to your dist output, you define the `files` field in your package.json as `["src", "dist"]`.
|
|
73
76
|
|
|
74
|
-
##
|
|
77
|
+
## V3 — TypeScript 6
|
|
78
|
+
|
|
79
|
+
V3 is a major release that requires TypeScript 6.0 or later.
|
|
80
|
+
|
|
81
|
+
TypeScript 6 aligns its defaults with the strict-by-default philosophy that this package has always followed. As a result, the base config is now leaner — options that are now TS6 defaults (`strict`, `esModuleInterop`) have been removed, and `isolatedModules` was dropped since it is implied by `verbatimModuleSyntax`.
|
|
75
82
|
|
|
76
|
-
|
|
83
|
+
TS6 also defaults `types` to `[]`, meaning `@types/*` packages are no longer auto-included. If your project depends on ambient type packages, you need to explicitly add them to your tsconfig:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"extends": "@codecompose/typescript-config/base",
|
|
88
|
+
"compilerOptions": {
|
|
89
|
+
"types": ["node"]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This aligns with the strict-by-default philosophy — type dependencies should be explicit.
|
|
95
|
+
|
|
96
|
+
For users upgrading from v2, see the migration guide below.
|
|
97
|
+
|
|
98
|
+
## Migrating from v2
|
|
99
|
+
|
|
100
|
+
- **TypeScript 6 is required** — there is no backward compatibility with TS5
|
|
101
|
+
- **Removed `strict: true`** — now a TS6 default
|
|
102
|
+
- **Removed `esModuleInterop: true`** — safe interop behavior is always on in TS6
|
|
103
|
+
- **Removed `isolatedModules: true`** — implied by `verbatimModuleSyntax`
|
|
104
|
+
- **Removed commented-out `baseUrl`** — deprecated in TS6
|
|
105
|
+
- **Action required:** if you relied on auto-included `@types/*` packages, add `"types": ["node"]` (or whatever types you need) to your tsconfig
|
|
106
|
+
|
|
107
|
+
## Caveats
|
|
77
108
|
|
|
78
109
|
Next.js v15 requires you to explicitly configure "includes". If you give it just "src" it will inject its own types on startup. I assume this will improve in the future.
|
|
79
110
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecompose/typescript-config",
|
|
3
3
|
"description": "Opinionated reusable TypeScript configurations",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.1-0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Thijs Koerselman",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/0x80/typescript-config"
|
|
10
|
+
},
|
|
7
11
|
"publishConfig": {
|
|
8
12
|
"access": "public"
|
|
9
13
|
},
|
|
@@ -31,5 +35,9 @@
|
|
|
31
35
|
"./shared-library": "./src/shared-library.json",
|
|
32
36
|
"./shared-react-library": "./src/shared-react-library.json"
|
|
33
37
|
},
|
|
34
|
-
"
|
|
35
|
-
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"typescript": ">=6.0.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {},
|
|
42
|
+
"packageManager": "pnpm@9.8.0"
|
|
43
|
+
}
|
package/src/base.json
CHANGED
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
"display": "Base configuration",
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
/* Base Options: */
|
|
6
|
-
"esModuleInterop": true,
|
|
7
6
|
"skipLibCheck": true,
|
|
8
7
|
"target": "esnext",
|
|
9
8
|
"lib": ["esnext"],
|
|
10
9
|
"allowJs": true,
|
|
11
10
|
"resolveJsonModule": true,
|
|
12
11
|
"moduleDetection": "force",
|
|
13
|
-
"isolatedModules": true,
|
|
14
12
|
"verbatimModuleSyntax": true,
|
|
15
13
|
|
|
16
14
|
/* Strictness */
|
|
17
|
-
"strict": true,
|
|
18
15
|
"noUncheckedIndexedAccess": true,
|
|
19
16
|
"noImplicitOverride": true,
|
|
20
17
|
"erasableSyntaxOnly": true,
|
|
@@ -24,7 +21,6 @@
|
|
|
24
21
|
"tsBuildInfoFile": "${configDir}/tsconfig.tsbuildinfo",
|
|
25
22
|
"module": "preserve",
|
|
26
23
|
"outDir": "${configDir}/dist",
|
|
27
|
-
// "baseUrl": "${configDir}",
|
|
28
24
|
"rootDir": "${configDir}/src",
|
|
29
25
|
"paths": {
|
|
30
26
|
"~/*": ["${configDir}/src/*"],
|