@btravstack/tsconfig 0.1.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 CHANGED
@@ -17,7 +17,38 @@ pnpm add -D @btravstack/tsconfig
17
17
 
18
18
  `base.json` enables `strict`, `exactOptionalPropertyTypes`,
19
19
  `noUncheckedIndexedAccess`, `noPropertyAccessFromIndexSignature`,
20
- `noImplicitOverride`, `noImplicitReturns`, and friends, on `NodeNext` /
21
- `ES2022`. Override anything in your own `compilerOptions`.
20
+ `noImplicitOverride`, `noImplicitReturns`, `verbatimModuleSyntax`,
21
+ `moduleDetection: "force"`, and friends, on `NodeNext` / `ES2022`. Override
22
+ anything in your own `compilerOptions`.
23
+
24
+ ## `app.json`, for a package that emits no declarations
25
+
26
+ An application — a deployment, an example, a test workspace — extends
27
+ `app.json` instead, which is `base.json` with `declaration` and
28
+ `declarationMap` off:
29
+
30
+ ```jsonc
31
+ // tsconfig.json
32
+ {
33
+ "extends": "@btravstack/tsconfig/app.json",
34
+ "compilerOptions": { "noEmit": true },
35
+ "include": ["src/**/*"],
36
+ }
37
+ ```
38
+
39
+ The flag is not free when nothing consumes the declarations it type-checks:
40
+ declaration emit is checked even under `noEmit`, so an exported value whose
41
+ type reaches a library's unexported brand symbols reports `TS4023` — **before**
42
+ the error the developer actually made. Measured on a DI composition root with
43
+ one unmet dependency: two `TS4023` lines about internal `ID` / `SERVICE`
44
+ symbols came first, and the sentence naming the missing port came third. With
45
+ `app.json` the actionable diagnostic is the only one.
46
+
47
+ A library keeps `base.json`: there the declaration check is the guarantee that
48
+ its consumers can build.
49
+
50
+ It does **not** set `types` — TypeScript auto-includes every reachable
51
+ `@types/*` package (Node included). This avoids forcing each consuming package to
52
+ declare a direct `@types/node` just to satisfy a `types: ["node"]` list.
22
53
 
23
54
  MIT © Benoit Travers
package/app.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./base.json",
4
+ "compilerOptions": {
5
+ "declaration": false,
6
+ "declarationMap": false
7
+ }
8
+ }
package/base.json CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  "target": "ES2022",
8
8
  "lib": ["ES2023"],
9
- "types": ["node"],
9
+ "moduleDetection": "force",
10
10
 
11
11
  "resolveJsonModule": true,
12
12
  "allowJs": true,
@@ -17,6 +17,7 @@
17
17
  "esModuleInterop": true,
18
18
  "forceConsistentCasingInFileNames": true,
19
19
  "isolatedModules": true,
20
+ "verbatimModuleSyntax": true,
20
21
  "skipLibCheck": true,
21
22
  "strict": true,
22
23
  "noUnusedLocals": true,
package/package.json CHANGED
@@ -1,28 +1,30 @@
1
1
  {
2
2
  "name": "@btravstack/tsconfig",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Shared strict TypeScript configuration for btravstack packages",
5
5
  "keywords": [
6
6
  "config",
7
7
  "tsconfig",
8
8
  "typescript"
9
9
  ],
10
- "homepage": "https://github.com/btravstack/config/tree/main/packages/tsconfig#readme",
10
+ "homepage": "https://github.com/btravstack/tools/tree/main/packages/tsconfig#readme",
11
11
  "bugs": {
12
- "url": "https://github.com/btravstack/config/issues"
12
+ "url": "https://github.com/btravstack/tools/issues"
13
13
  },
14
14
  "license": "MIT",
15
15
  "author": "Benoit TRAVERS <benoit.travers.fr@gmail.com>",
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "https://github.com/btravstack/config.git",
18
+ "url": "https://github.com/btravstack/tools.git",
19
19
  "directory": "packages/tsconfig"
20
20
  },
21
21
  "files": [
22
+ "app.json",
22
23
  "base.json"
23
24
  ],
24
25
  "type": "module",
25
26
  "exports": {
27
+ "./app.json": "./app.json",
26
28
  "./base.json": "./base.json"
27
29
  },
28
30
  "publishConfig": {