@codefast/typescript-config 0.8.0 → 0.9.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,25 @@
1
1
  # @codefast/typescript-config
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#809](https://github.com/codefastlabs/codefast/pull/809) [`7485645`](https://github.com/codefastlabs/codefast/commit/74856453cc18f38aed156af0ccb2970c0199477f) Thanks [@thevuong](https://github.com/thevuong)! - `exactOptionalPropertyTypes` now defaults to `true` in `base.json`, so every preset (`base`, `library`, `react`) turns
8
+ it on and each package inherits one source of truth instead of repeating the flag. Packages not yet ready for it opt out
9
+ explicitly with `"exactOptionalPropertyTypes": false` (`@codefast/cli`, `@codefast/tailwind-variants`, and the private
10
+ benchmark packages). A consumer extending these presets will now type-check under `exactOptionalPropertyTypes`; set it
11
+ back to `false` locally if that surfaces errors you are not ready to fix.
12
+
13
+ ### Patch Changes
14
+
15
+ - [#791](https://github.com/codefastlabs/codefast/pull/791) [`37a212b`](https://github.com/codefastlabs/codefast/commit/37a212b4d805588413159e11e872b98db82326bf) Thanks [@thevuong](https://github.com/thevuong)! - Point the README's license badge and "License" section at the package's own `LICENSE` file instead of the monorepo root.
16
+
17
+ - [#793](https://github.com/codefastlabs/codefast/pull/793) [`83cceeb`](https://github.com/codefastlabs/codefast/commit/83cceeb2168e063441125643a83e9555fb2d2048) Thanks [@thevuong](https://github.com/thevuong)! - Make "MIT" in the README's License section the link to the package's `LICENSE` file.
18
+
19
+ - [#796](https://github.com/codefastlabs/codefast/pull/796) [`ba04d27`](https://github.com/codefastlabs/codefast/commit/ba04d2703c59a1677f52e6a9fffd0ec202328218) Thanks [@thevuong](https://github.com/thevuong)! - Rewrite the README around one structure — what the package is, installation and requirements, a complete quick start,
20
+ the concepts in learning order, then the documents and the license — with every API claim checked against the current
21
+ code and no figures that go stale.
22
+
3
23
  ## 0.8.0
4
24
 
5
25
  ### Minor Changes
package/README.md CHANGED
@@ -1,10 +1,24 @@
1
1
  # @codefast/typescript-config
2
2
 
3
- Shared TypeScript configuration presets — one strict, bundler-first base, focused variants for libraries, React, and
4
- Next.js, and a build overlay that turns on `.d.ts` emit.
3
+ Shared TypeScript configuration presets for projects that want one strict, bundler-first baseline and small, focused
4
+ variants for libraries, React, and Next.js.
5
5
 
6
6
  [![npm version](https://img.shields.io/npm/v/@codefast/typescript-config)](https://www.npmjs.com/package/@codefast/typescript-config)
7
- [![license](https://img.shields.io/npm/l/@codefast/typescript-config)](https://github.com/codefastlabs/codefast/blob/main/LICENSE)
7
+ [![license](https://img.shields.io/npm/l/@codefast/typescript-config)](./LICENSE)
8
+
9
+ ## Overview
10
+
11
+ `@codefast/typescript-config` gives you one strict, bundler-first TypeScript baseline and a few focused variants — for
12
+ libraries, React, and Next.js. Extend the preset that fits your project, then override anything you need locally.
13
+
14
+ The presets are plain JSON `tsconfig` files. There's no runtime code, and nothing to import.
15
+
16
+ - **Strict by default.** `strict`, `noUncheckedIndexedAccess`, `noImplicitOverride`, and `verbatimModuleSyntax` come
17
+ from the base that every preset extends.
18
+ - **Bundler-first.** An ESNext target and module with `moduleResolution: "bundler"`, so `exports` and `imports` maps
19
+ resolve the way Vite, esbuild, and friends resolve them.
20
+ - **Type-check only.** The presets set `noEmit`; a separate build overlay turns on emit and `.d.ts` generation.
21
+ - **Plain JSON.** No runtime code, nothing to import.
8
22
 
9
23
  ## Installation
10
24
 
@@ -12,15 +26,14 @@ Next.js, and a build overlay that turns on `.d.ts` emit.
12
26
  pnpm add -D @codefast/typescript-config
13
27
  ```
14
28
 
15
- TypeScript >= 5.0 is a peer dependency (`moduleResolution: "bundler"` requires it). The package ships plain JSON — it
16
- adds no runtime code.
29
+ `@codefast/typescript-config` requires Node.js 24 or later, and `typescript` 5 or later as a peer dependency —
30
+ `moduleResolution: "bundler"` is a TypeScript 5 option. The package is published on 0.x and versioned on its own track:
31
+ breaking changes ship as minor versions, so pin the minor version when you need stability.
17
32
 
18
- ## Usage
33
+ ## Quick start
19
34
 
20
- Extend the preset that matches your project in `tsconfig.json`. Keep the `.json` extension — the package export map only
21
- exposes the full file names.
22
-
23
- A generic TypeScript project:
35
+ Extend the preset that matches your project in `tsconfig.json`. Keep the `.json` extension — the package exports the
36
+ full file names only.
24
37
 
25
38
  ```json
26
39
  {
@@ -29,6 +42,29 @@ A generic TypeScript project:
29
42
  }
30
43
  ```
31
44
 
45
+ Options you set locally always win, so overriding a preset value takes one line:
46
+
47
+ ```json
48
+ {
49
+ "extends": "@codefast/typescript-config/library.json",
50
+ "compilerOptions": {
51
+ "lib": ["DOM", "DOM.Iterable", "ESNext"]
52
+ }
53
+ }
54
+ ```
55
+
56
+ ## Presets
57
+
58
+ | Preset | Extends | Purpose |
59
+ | -------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
60
+ | `base.json` | — | Strict, bundler-first baseline: ESNext target and module, DOM + ESNext libs, type-check only. |
61
+ | `library.json` | `base.json` | Headless packages: `lib` is `ESNext` only, so relying on a browser global is a type error. |
62
+ | `react.json` | `base.json` | React with the automatic JSX runtime (`jsx: "react-jsx"`) — components need no `React` import. |
63
+ | `next.json` | `base.json` | Next.js apps: `jsx: "preserve"`, `incremental` builds, and the `next` TypeScript plugin. |
64
+ | `library-build.json` | (overlay) | Build-emit overrides for a build config: `noEmit: false`, `declaration` + `isolatedDeclarations`, declaration and source maps, `types: ["node"]`. |
65
+
66
+ ### Choosing a preset
67
+
32
68
  A publishable package with no browser coupling:
33
69
 
34
70
  ```json
@@ -56,40 +92,55 @@ A Next.js app:
56
92
  }
57
93
  ```
58
94
 
59
- Options you set locally always win, so overriding a preset value is a one-line change:
95
+ ### Building with `tsc`
96
+
97
+ `library-build.json` is an overlay, not a standalone preset. It carries only the emit options, so layer it over your
98
+ development config in a separate `tsconfig.build.json`. List both in `extends` to keep the strictness from
99
+ `library.json` and add `.d.ts` emit on top:
60
100
 
61
101
  ```json
62
102
  {
63
- "extends": "@codefast/typescript-config/library.json",
103
+ "extends": ["./tsconfig.json", "@codefast/typescript-config/library-build.json"],
64
104
  "compilerOptions": {
65
- "lib": ["DOM", "DOM.Iterable", "ESNext"]
66
- }
105
+ "rootDir": "./src",
106
+ "outDir": "./dist"
107
+ },
108
+ "include": ["src/**/*.ts"],
109
+ "exclude": ["src/**/*.test.ts"]
67
110
  }
68
111
  ```
69
112
 
70
- ## Presets
71
-
72
- | Preset | Extends | Purpose |
73
- | -------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
74
- | `base.json` | — | Strict, bundler-first baseline: ESNext target/module, DOM + ESNext libs, type-check only. |
75
- | `library.json` | `base.json` | Headless packages: drops the DOM libs so reliance on browser globals is a type error. |
76
- | `react.json` | `base.json` | React 17+ automatic JSX transform (`jsx: "react-jsx"`) — no `React` import needed. |
77
- | `next.json` | `base.json` | Next.js apps: `jsx: "preserve"`, incremental builds, and the `next` TypeScript plugin. |
78
- | `library-build.json` | (overlay) | Build-emit overrides layered over `library.json` in a build config: `noEmit: false`, `.d.ts` via `isolatedDeclarations`, plus declaration and source maps. |
113
+ Then `tsc -p tsconfig.build.json` emits `.js`, `.d.ts`, and their maps into `dist/`. `isolatedDeclarations` requires an
114
+ explicit type annotation on every export, which is what lets declarations be produced file by file.
79
115
 
80
116
  ## Notable compiler options
81
117
 
82
- All strictness comes from `base.json`, so every preset inherits it:
118
+ Every preset inherits its strictness from `base.json`:
83
119
 
84
120
  - `strict` — the full strict family (`strictNullChecks`, `noImplicitAny`, and friends).
85
121
  - `noUncheckedIndexedAccess` — indexed access is typed `T | undefined`, forcing explicit handling.
122
+ - `noImplicitOverride` — a method that overrides a base-class member must say `override`.
123
+ - `verbatimModuleSyntax` — type-only imports must be written `import type`, so a transpiler can drop them without type
124
+ information.
86
125
  - `isolatedModules` + `moduleDetection: "force"` — every file is a module and must transpile in isolation, as bundlers
87
126
  require.
88
127
  - `module: "ESNext"` + `moduleResolution: "bundler"` — modern ESM with bundler-style `exports`/`imports` resolution.
89
- - `noEmit` — presets type-check only; emitting is your bundler's job (override in a build config if `tsc` emits for
90
- you).
128
+ - `noEmit` — presets type-check only; emitting is your bundler's job, or `library-build.json`'s when `tsc` builds for
129
+ you.
91
130
  - `forceConsistentCasingInFileNames` — catches import-path casing mismatches before they break case-sensitive CI.
131
+ - `skipLibCheck`, `esModuleInterop`, `resolveJsonModule` — pragmatic defaults for consuming third-party packages and
132
+ JSON.
133
+
134
+ ## Documentation
135
+
136
+ - [codefastlabs.com/docs/typescript-config](https://codefastlabs.com/docs/typescript-config) — this document, rendered.
137
+ - [`CHANGELOG.md`](./CHANGELOG.md) — release notes for every published version.
138
+
139
+ ## Contributing
140
+
141
+ The package is developed in the [codefast monorepo](https://github.com/codefastlabs/codefast); the repo-wide
142
+ [contributing guide](../../CONTRIBUTING.md) covers setup, the test taxonomy, and the release flow.
92
143
 
93
144
  ## License
94
145
 
95
- MIT — see [LICENSE](https://github.com/codefastlabs/codefast/blob/main/LICENSE).
146
+ Released under the [MIT License](./LICENSE).
package/base.json CHANGED
@@ -2,6 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/tsconfig",
3
3
  "compilerOptions": {
4
4
  "esModuleInterop": true,
5
+ "exactOptionalPropertyTypes": true,
5
6
  "forceConsistentCasingInFileNames": true,
6
7
  "isolatedModules": true,
7
8
  "lib": ["DOM", "DOM.Iterable", "ESNext"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefast/typescript-config",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Shared TypeScript configuration for the monorepo",
5
5
  "keywords": [
6
6
  "browser",