@williamthorsen/tsconfig 0.2.0 → 0.3.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 +17 -17
- package/package.json +1 -1
- package/tsconfig.base.json +3 -2
package/README.md
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Shared TypeScript base config for Node-only projects. Inlines the settings of [`@tsconfig/strictest`](https://www.npmjs.com/package/@tsconfig/strictest) and adds the Node and build options it leaves out, so a consuming repo declares only what is genuinely its own.
|
|
4
4
|
|
|
5
5
|
<!-- section:release-notes -->
|
|
6
|
-
## Release notes — v0.
|
|
6
|
+
## Release notes — v0.3.0 (2026-08-07)
|
|
7
7
|
|
|
8
8
|
### 🎉 Features
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- Support explicit resource management for consumers (#148)
|
|
11
11
|
|
|
12
|
-
Adds
|
|
12
|
+
Adds `ESNext.Disposable` to the libraries recognized by TypeScript in the exported base config. This enables the use of `using` and `await using` declarations.
|
|
13
13
|
<!-- /section:release-notes -->
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
@@ -34,31 +34,31 @@ pnpm add -D @williamthorsen/tsconfig
|
|
|
34
34
|
|
|
35
35
|
Everything `@tsconfig/strictest` sets, plus the Node and build options it omits:
|
|
36
36
|
|
|
37
|
-
| Option | Value
|
|
38
|
-
| ---------------------------- |
|
|
39
|
-
| `allowImportingTsExtensions` | `true`
|
|
40
|
-
| `lib` | `["ES2025"]` |
|
|
41
|
-
| `module` | `"NodeNext"`
|
|
42
|
-
| `moduleDetection` | `"force"`
|
|
43
|
-
| `noEmit` | `true`
|
|
44
|
-
| `removeComments` | `true`
|
|
45
|
-
| `target` | `"ES2025"`
|
|
37
|
+
| Option | Value |
|
|
38
|
+
| ---------------------------- | --------------------------------- |
|
|
39
|
+
| `allowImportingTsExtensions` | `true` |
|
|
40
|
+
| `lib` | `["ES2025", "ESNext.Disposable"]` |
|
|
41
|
+
| `module` | `"NodeNext"` |
|
|
42
|
+
| `moduleDetection` | `"force"` |
|
|
43
|
+
| `noEmit` | `true` |
|
|
44
|
+
| `removeComments` | `true` |
|
|
45
|
+
| `target` | `"ES2025"` |
|
|
46
46
|
|
|
47
|
-
`target` and `lib` are pinned to a Node 24 floor.
|
|
47
|
+
`target` and `lib` are pinned to a Node 24 floor. `ESNext.Disposable` supplies the explicit-resource-management declarations (`using`, `Disposable`, `DisposableStack`), which Node 24 implements and no numbered lib yet carries.
|
|
48
48
|
|
|
49
49
|
## What the consumer owns
|
|
50
50
|
|
|
51
51
|
The base declares none of these:
|
|
52
52
|
|
|
53
|
-
- **`types
|
|
54
|
-
- **`paths
|
|
55
|
-
- **`jsx
|
|
53
|
+
- **`types`**: The ambient type packages in scope. Most Node projects want `["node"]`; declaring it narrows the default, which would otherwise pull in every `@types/*` package installed.
|
|
54
|
+
- **`paths`**: TypeScript resolves `baseUrl`-less `paths` relative to the file that _declares_ them, so a path alias set in this package would resolve inside `node_modules`. Aliases must be declared by the config that owns the source tree.
|
|
55
|
+
- **`jsx`**: Meaningless for the many consumers with no JSX at all.
|
|
56
56
|
|
|
57
57
|
`include` and `exclude` are likewise the consumer's, since only it knows its own layout.
|
|
58
58
|
|
|
59
59
|
## Emitting
|
|
60
60
|
|
|
61
|
-
The base sets `noEmit: true`, on the assumption that a separate build step owns emit. A consumer that builds with this config directly must override `noEmit`
|
|
61
|
+
The base sets `noEmit: true`, on the assumption that a separate build step owns emit. A consumer that builds with this config directly must override `noEmit` and, if it keeps `allowImportingTsExtensions`, pair that with `rewriteRelativeImportExtensions` so `./foo.ts` specifiers survive the rewrite.
|
|
62
62
|
|
|
63
63
|
## License
|
|
64
64
|
|
package/package.json
CHANGED
package/tsconfig.base.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"compilerOptions": {
|
|
9
9
|
// Inlined from `@tsconfig/strictest`, in upstream's order. Not reached through `extends`, because
|
|
10
10
|
// resolvers that don't realpath pnpm symlinks can't follow the second hop. The root test
|
|
11
|
-
// `__tests__/tsconfig-base.
|
|
11
|
+
// `__tests__/tsconfig-base.tool.test.ts` asserts this block still matches the installed devDependency.
|
|
12
12
|
"strict": true,
|
|
13
13
|
"allowUnusedLabels": false,
|
|
14
14
|
"allowUnreachableCode": false,
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
// Permit `./foo.ts` specifiers; the build step rewrites them on emit.
|
|
30
30
|
"allowImportingTsExtensions": true,
|
|
31
31
|
// Without this, `lib` follows `target` into the `.full` variant, admitting DOM globals.
|
|
32
|
-
|
|
32
|
+
// `ESNext.Disposable` carries the explicit-resource-management declarations; no numbered lib has them.
|
|
33
|
+
"lib": ["ES2025", "ESNext.Disposable"],
|
|
33
34
|
// Default is `ES2022` with `Bundler` resolution — wrong for published Node packages.
|
|
34
35
|
"module": "NodeNext",
|
|
35
36
|
// Files with no import or export would otherwise be scripts sharing global scope.
|