@codefast/typescript-config 0.10.0 → 0.11.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @codefast/typescript-config
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1068](https://github.com/codefastlabs/codefast/pull/1068) Add the `node22.json` and `node22-dom.json` overlays, which narrow `lib` and `target` to what Node 22 ships for a
8
+ package whose floor is on Node 22, and lower the package's own Node.js floor to 22.12.
9
+
3
10
  ## 0.10.0
4
11
 
5
12
  ### Minor Changes
package/README.md CHANGED
@@ -19,7 +19,8 @@ The presets are plain JSON `tsconfig` files. There's no runtime code, and nothin
19
19
  way Vite, esbuild, and friends resolve them.
20
20
  - **`lib` and `target` match the runtime floors**: both are `ES2025`, the newest edition that Node 24 and the browser
21
21
  floor both ship ([support policy](../../SUPPORT.md)). A builtin newer than that, such as `Map.prototype.getOrInsert`,
22
- is a type error here rather than a runtime crash on the floor. Move them together only when a floor moves.
22
+ is a type error here rather than a runtime crash on the floor. A package whose Node floor is 22 layers a floor overlay
23
+ on top, which narrows both to what Node 22 ships.
23
24
  - **Ambient types follow the runtime.** No preset loads `@types/node` or lists `ESNext.Disposable`. A program that runs
24
25
  on Node adds `types: ["node"]`, which brings the Node globals and explicit resource management with it. A browser
25
26
  program leaves both out: Safari has not shipped explicit resource management yet.
@@ -32,7 +33,7 @@ The presets are plain JSON `tsconfig` files. There's no runtime code, and nothin
32
33
  pnpm add -D @codefast/typescript-config
33
34
  ```
34
35
 
35
- `@codefast/typescript-config` requires Node.js 24 or later, and `typescript` 7 or later as a peer dependency —
36
+ `@codefast/typescript-config` requires Node.js 22.12 or later, and `typescript` 7 or later as a peer dependency —
36
37
  TypeScript 7 is the one compiler the presets are checked against. The package is published on 0.x and versioned on its
37
38
  own track: breaking changes ship as minor versions, so pin the minor version when you need stability.
38
39
 
@@ -67,6 +68,8 @@ Options you set locally always win, so adjusting a preset takes one line — her
67
68
  | `library.json` | `base.json` | Headless packages: `lib` is `ES2025` only, so relying on a browser global is a type error. A package that runs on Node adds `types: ["node"]`. |
68
69
  | `react.json` | `base.json` | React with the automatic JSX runtime (`jsx: "react-jsx"`) — components need no `React` import. |
69
70
  | `next.json` | `base.json` | Next.js apps: `jsx: "preserve"`, `incremental` builds, and the `next` TypeScript plugin. |
71
+ | `node22.json` | (overlay) | Node 22 floor for a headless package: `lib` is `ES2024` plus the Set methods and iterator helpers Node 22 ships, and `target` is `ES2024`. |
72
+ | `node22-dom.json` | (overlay) | Node 22 floor for a package that also renders in a browser: the same, with `DOM` and `DOM.Iterable`. |
70
73
  | `library-build.json` | (overlay) | Build-emit overrides for a build config: `noEmit: false`, `declaration` + `isolatedDeclarations`, declaration and source maps, and `types: []`, so test-only ambient types stay out of the build. |
71
74
 
72
75
  ### Choosing a preset
@@ -114,6 +117,22 @@ Next.js 16.3 and later type-check with TypeScript 7 through its `tsc` CLI (`expe
114
117
  default). Earlier Next.js releases need TypeScript 6's compiler API, so an app on one of them stays on 0.9.x of this
115
118
  package.
116
119
 
120
+ ### Targeting a Node 22 floor
121
+
122
+ The presets assume Node 24. A package whose `engines.node` floor is on Node 22 lists a floor overlay last in `extends`,
123
+ so `lib` and `target` drop to what Node 22 ships and `RegExp.escape`, `Promise.try`, `Float16Array` or a regular
124
+ expression modifier become type errors rather than crashes on the floor:
125
+
126
+ ```json
127
+ {
128
+ "extends": ["@codefast/typescript-config/react.json", "@codefast/typescript-config/node22-dom.json"],
129
+ "include": ["src"]
130
+ }
131
+ ```
132
+
133
+ `node22.json` replaces `lib` with no DOM, so a headless package pairs it with `library.json`; a package that renders in
134
+ a browser takes `node22-dom.json` instead. A local `lib` still wins over both.
135
+
117
136
  ### Building with `tsc`
118
137
 
119
138
  `library-build.json` is an overlay, not a standalone preset. It carries only the emit options, so layer it over your
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "lib": ["DOM", "DOM.Iterable", "ES2024", "ES2025.Collection", "ES2025.Iterator"],
5
+ "target": "ES2024"
6
+ },
7
+ "display": "Node 22 floor overlay for packages that also render in a browser"
8
+ }
package/node22.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "lib": ["ES2024", "ES2025.Collection", "ES2025.Iterator"],
5
+ "target": "ES2024"
6
+ },
7
+ "display": "Node 22 floor overlay for headless packages"
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefast/typescript-config",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Shared TypeScript configuration for the monorepo",
5
5
  "keywords": [
6
6
  "browser",
@@ -35,6 +35,8 @@
35
35
  "./library.json": "./library.json",
36
36
  "./library-build.json": "./library-build.json",
37
37
  "./next.json": "./next.json",
38
+ "./node22.json": "./node22.json",
39
+ "./node22-dom.json": "./node22-dom.json",
38
40
  "./react.json": "./react.json"
39
41
  },
40
42
  "publishConfig": {
@@ -44,6 +46,6 @@
44
46
  "typescript": ">=7.0.0"
45
47
  },
46
48
  "engines": {
47
- "node": ">=24.0.0"
49
+ "node": ">=22.12.0"
48
50
  }
49
51
  }