@vllnt/typescript 3.0.1-canary.4a7b45d → 3.0.1-canary.a2c7289

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.
Files changed (4) hide show
  1. package/CHANGELOG.md +14 -6
  2. package/README.md +245 -117
  3. package/llms.txt +28 -10
  4. package/package.json +11 -6
package/CHANGELOG.md CHANGED
@@ -2,23 +2,30 @@
2
2
 
3
3
  All notable changes to this project are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project uses semantic versioning.
4
4
 
5
- ## [Unreleased]
5
+ ## [3.0.1] - 2026-11-27
6
+
7
+ Presets are unchanged from 3.0.0. This release changes package metadata and the shipped documentation.
6
8
 
7
9
  ### Added
8
10
 
9
- - `README.md` and `llms.txt` have a "For coding agents" note: the documentation ships in `node_modules/@vllnt/typescript/` and matches the installed version. `llms.txt` links to the shipped `README.md` and `CHANGELOG.md` with relative paths and adds related-package and ecosystem links; the README adds a related-packages section and documents each preset's notable compiler options. Presets are unchanged.
10
- - `scripts/check-package-contents.sh` fails when a path listed in `.package-contents-required` is missing from the tarball, and `pnpm check` runs it with its tests.
11
+ - The README follows the shared @vllnt layout for coding agents: a "For coding agents" note (the documentation ships in `node_modules/@vllnt/typescript/` and matches the installed version), When to use, Install, Quick start, API (each preset's own `compilerOptions`), Common tasks, Errors and fixes, Limits and gotchas, Compatibility, Related packages, and a Links section (package docs and release feed, package index and search, source, issues and npm, Discord and X, company and author, sponsor), which replaces the Author section, then the footer. `llms.txt` rewrites the summary, adds the same note and when-to-use, links to the shipped `README.md` (API and errors tables) and `CHANGELOG.md` with relative paths, and ends with a six-link Ecosystem block (package page, release feed, all @vllnt packages, search, vllnt, author).
12
+ - `tests/docs.test.mjs` checks the README and `llms.txt` against the packed package under TypeScript 6 and 7: required sections in order, the install command and quick start within the first 40 lines, the `llms.txt` summary line, that the packed files include `README.md`, `llms.txt` and `CHANGELOG.md`, tagged code blocks, relative links and anchors, every export in the API table, each preset's options, and every code in "Errors and fixes" with each message found in at least one compiler's output. It compiles every README `tsconfig.json` and source example and requires exactly the diagnostics its `// error` comments mark; the Quick start and "Build an npm library" examples must emit exactly the files listed, and the other emitting examples must emit `index.js`. No packed or tracked file may name the retired vllnt domain.
13
+ - `scripts/check-package-contents.sh` checks the packed file list against an allowlist and the privacy denylist, rejects test and spec files of every flavour (`.ts`, `.tsx`, `.js`, `.mjs`, `.cjs`, `.mts`, `.cts`, `.jsx`), `__tests__/` and `.env` files, and fails when a path listed in `.package-contents-required` is missing from the tarball. `pnpm check`, the canary job and the release job run it before publishing; it reads both the array-shaped and the npm 12 object-shaped `npm pack --json` output.
14
+ - A Privacy Guard workflow runs on every push and pull request. It checks commit author, committer and trailer emails against an allowlist of GitHub noreply addresses, rejects private hostnames and internal IPs in commit metadata, scans tracked files against a privacy denylist, and runs a gitleaks secret scan.
11
15
 
12
16
  ### Changed
13
17
 
14
- - `package.json` `homepage` is https://oss.vllnt.com/packages/typescript, with more accurate `keywords`. Publish path filters include `README.md`, `llms.txt` and `CHANGELOG.md`, so a documentation-only change publishes a canary.
18
+ - `package.json` `homepage` is https://oss.vllnt.com/packages/typescript, and `description` and `keywords` name what the package does and the stack. Publish path filters include `README.md`, `llms.txt` and `CHANGELOG.md`, so a documentation-only change publishes a canary.
15
19
  - Upgraded the development dependencies `vitest` and `@vitest/coverage-v8` to 5.1.1 and `prettier` to 3.10.1, and added a scoped override to a patched `minimatch` 11 (11.0.9) for GHSA-g3hv-75wg-m249 (moderate, reached only through the development lint toolchain). Removed the unused root development dependency `@types/react-dom` (the integration fixtures declare their own). Presets and the packed file list are unchanged.
16
20
  - Upgraded the development dependency `@vllnt/eslint-config` to 2.1.0 and the integration fixtures to `next` 16.4.6 and `vite` 8.3.8. No change to the presets or the packed file list.
17
21
  - Moved the repository package manager to pnpm 12.22.0 (`packageManager`; the lockfile now also pins pnpm itself). No change to the presets or the packed file list.
18
22
 
19
23
  ### Fixed
20
24
 
21
- - `scripts/check-package-contents.sh` reads the object-shaped `npm pack --json` output of npm 12. The canary job had failed with "npm pack reported no files" since the check was added.
25
+ - The README and `llms.txt` listed TS2322 as an `exactOptionalPropertyTypes` diagnostic; it is TS2412 (assigning `undefined` to an optional property), next to TS2375 and TS2379.
26
+ - The README said that TypeScript 7 cannot disable strict mode. It can; with these presets, `strict: false` also needs `exactOptionalPropertyTypes: false` (TS5052).
27
+ - `pnpm check` type-checks the repository scripts and tests (`pnpm typecheck`, TypeScript 6 and 7). The root `tsconfig.json` enabled `checkJs`, but nothing ran it, and it had 23 errors under TypeScript 7 and 21 under TypeScript 6. The root `tsconfig.json` sets `declaration: false`, because it only type-checks.
28
+ - The package test's temporary consumer install now follows the repository's 7-day release-age rule (`minimumReleaseAge`) and its `@vllnt/*` exclusion: it gets a copy of the repository `pnpm-workspace.yaml`. Before, it had no workspace file, so it resolved the newest transitive versions without that rule.
22
29
 
23
30
  ## [3.0.0] - 2026-11-16
24
31
 
@@ -85,7 +92,8 @@ The flags add diagnostics and leave JavaScript output unchanged, but inferred de
85
92
  - Added `base.json`, `nodejs.json`, `node-library.json`, `react.json`, and `nextjs.json` presets.
86
93
  - Documented Node.js 22+ and TypeScript 5+ expectations.
87
94
 
88
- [Unreleased]: https://github.com/vllnt/typescript/compare/v2.0.1...HEAD
95
+ [3.0.1]: https://github.com/vllnt/typescript/compare/v3.0.0...v3.0.1
96
+ [3.0.0]: https://github.com/vllnt/typescript/compare/v2.0.1...v3.0.0
89
97
  [2.0.1]: https://github.com/vllnt/typescript/compare/v2.0.0...v2.0.1
90
98
  [2.0.0]: https://github.com/vllnt/typescript/compare/v1.0.0...v2.0.0
91
99
  [1.0.0]: https://github.com/vllnt/typescript/releases/tag/v1.0.0
package/README.md CHANGED
@@ -1,189 +1,311 @@
1
1
  # @vllnt/typescript
2
2
 
3
- Shared TypeScript configurations for Node.js, libraries, React, and Next.js. Version 3 targets the native TypeScript 7 compiler while retaining a tested TypeScript 6 migration path.
4
-
5
- Use these independently in any project; no vllnt monorepo or runtime dependency
6
- is required. Extend a preset, then supply project-specific paths and ambient types.
3
+ Shared tsconfig presets for Node.js apps, npm libraries, React and Next.js, with strict type-checking, tested with TypeScript 6 and 7.
7
4
 
8
5
  ## For coding agents
9
6
 
10
- The documentation ships inside the package: `node_modules/@vllnt/typescript/` contains `README.md`, `llms.txt` and `CHANGELOG.md` next to the preset files, and they match the installed version. Read them before writing a `tsconfig.json`.
7
+ These docs ship in `node_modules/@vllnt/typescript/` (`README.md`, `llms.txt`, `CHANGELOG.md`) and match the installed version. The package contains only JSON presets for `extends`; there is no JavaScript or type export to import.
11
8
 
12
- ## Install
9
+ ## When to use
10
+
11
+ - Use it when one `extends` line should set the compiler options of a Node.js app, an npm library, a bundled React app or a Next.js app.
12
+ - Use it when the project compiles with TypeScript 7, or with TypeScript 6.0.2 or newer.
13
+ - Do not use it on TypeScript 5 or older, or for ES5 output (TypeScript 7 removed `target: "ES5"`): use a `@tsconfig/*` preset made for your TypeScript version and runtime, such as `@tsconfig/node22`, or your own `tsconfig.json`.
14
+ - Do not use it when the code cannot pass `strict`: write your own `tsconfig.json`. If only the extra flags fail, turn them off one at a time (see [Common tasks](#turn-off-one-strictness-flag)).
13
15
 
14
- For TypeScript 7 projects:
16
+ ## Install
15
17
 
16
18
  ```sh
17
- pnpm add --save-dev @vllnt/typescript@^3 typescript@^7
19
+ pnpm add --save-dev @vllnt/typescript@^3 typescript@^7 @types/node@^22
18
20
  ```
19
21
 
20
- For tools that still require the TypeScript JavaScript API, install TypeScript 7 as the build compiler and TypeScript 6 under the canonical package name:
22
+ ## Quick start
23
+
24
+ A Node.js application with its sources in `src/`. `tsconfig.json`:
21
25
 
22
26
  ```json
23
27
  {
24
- "devDependencies": {
25
- "@typescript/native": "npm:typescript@^7.0.2",
26
- "@vllnt/typescript": "^3.0.0",
27
- "typescript": "npm:@typescript/typescript6@^6.0.2"
28
- }
28
+ "extends": "@vllnt/typescript/nodejs.json",
29
+ "compilerOptions": { "outDir": "dist", "rootDir": "src", "types": ["node"] },
30
+ "include": ["src"]
29
31
  }
30
32
  ```
31
33
 
32
- This is the [official side-by-side migration arrangement](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/): `tsc` runs TypeScript 7, `tsc6` runs TypeScript 6, and tools such as `typescript-eslint` can continue importing the TypeScript 6 API.
34
+ `src/index.ts`:
33
35
 
34
- ## Presets
36
+ ```ts
37
+ import { cwd } from "node:process";
38
+
39
+ export const directory: string = cwd();
40
+ ```
35
41
 
36
- Extend one preset per project. Every preset extends `base.json`, so it inherits the [base defaults](#base-defaults).
42
+ Run `pnpm exec tsc`. It writes `dist/index.js`, `dist/index.js.map` and `dist/index.d.ts`.
37
43
 
38
- | Preset | Extend it for | Module / resolution | Target / lib | Emit | Other options |
39
- | ------------------- | ----------------------------------------------------------------- | ------------------- | ---------------------------------- | ------------------------------------- | -------------------------------------------------------------- |
40
- | `base.json` | Other environments; you set `module`, `target` and `lib` yourself | Not set | Not set | Not set | Strictness and interop defaults only |
41
- | `nodejs.json` | Node.js applications | NodeNext / NodeNext | ES2024 / ES2024 | JavaScript, declarations, source maps | None |
42
- | `node-library.json` | Publishable npm packages | NodeNext / NodeNext | ES2024 / ES2024 | JavaScript, declarations, both maps | `declarationMap` |
43
- | `react.json` | Bundled React applications (for example Vite) | ESNext / Bundler | ES2022 / DOM, DOM.Iterable, ES2024 | JavaScript, declarations, source maps | `jsx: "react-jsx"` |
44
- | `nextjs.json` | Next.js applications | ESNext / Bundler | ES2022 / DOM, DOM.Iterable, ES2024 | None (`noEmit`) | `jsx: "preserve"`, `allowJs`, `incremental`, the `next` plugin |
44
+ ## API
45
45
 
46
- Emitting presets do not enable `incremental`. Unless you opt in, a clean build emits every output even when a `.tsbuildinfo` file is left over. If you set `incremental: true`, delete the `.tsbuildinfo` file together with the output directory before a clean build. `nextjs.json` keeps `incremental` because it does not emit; if you override `noEmit`, also set `incremental: false`.
46
+ The package exports these files. Extend one preset per project; every preset extends `base.json`.
47
47
 
48
- ### Node.js application
48
+ | Export | Use for | Reference |
49
+ | ------------------------------------- | ----------------------------------------------------------- | -------------------------------------- |
50
+ | `@vllnt/typescript/base.json` | Strictness defaults only; you set `module`, `target`, `lib` | [base.json](#basejson) |
51
+ | `@vllnt/typescript/nodejs.json` | Node.js applications | [nodejs.json](#nodejsjson) |
52
+ | `@vllnt/typescript/node-library.json` | npm packages that publish JavaScript and declarations | [node-library.json](#node-libraryjson) |
53
+ | `@vllnt/typescript/react.json` | React applications built by a bundler such as Vite | [react.json](#reactjson) |
54
+ | `@vllnt/typescript/nextjs.json` | Next.js applications | [nextjs.json](#nextjsjson) |
55
+ | `@vllnt/typescript/package.json` | Reading the installed version | [Compatibility](#compatibility) |
56
+
57
+ Each block below is the preset's own `compilerOptions`. Options you set after `extends` replace them; arrays such as `types` and `lib` are replaced, not merged.
58
+
59
+ ### base.json
49
60
 
50
61
  ```json
51
62
  {
52
- "extends": "@vllnt/typescript/nodejs.json",
53
- "compilerOptions": {
54
- "outDir": "dist",
55
- "rootDir": "src",
56
- "types": ["node"]
57
- },
58
- "include": ["src"]
63
+ "strict": true,
64
+ "esModuleInterop": true,
65
+ "forceConsistentCasingInFileNames": true,
66
+ "isolatedModules": true,
67
+ "skipLibCheck": true,
68
+ "noUncheckedIndexedAccess": true,
69
+ "noUncheckedSideEffectImports": true,
70
+ "noImplicitOverride": true,
71
+ "noImplicitReturns": true,
72
+ "noFallthroughCasesInSwitch": true,
73
+ "exactOptionalPropertyTypes": true,
74
+ "stableTypeOrdering": true,
75
+ "types": [],
76
+ "libReplacement": false,
77
+ "resolveJsonModule": true
59
78
  }
60
79
  ```
61
80
 
62
- ### Node library
81
+ `types: []` loads no ambient `@types` package; list each one you need. `stableTypeOrdering` makes TypeScript 6 order types as TypeScript 7 does, and can make TypeScript 6 slower.
82
+
83
+ ### nodejs.json
84
+
85
+ ```json
86
+ {
87
+ "lib": ["ES2024"],
88
+ "module": "NodeNext",
89
+ "moduleResolution": "NodeNext",
90
+ "target": "ES2024",
91
+ "declaration": true,
92
+ "sourceMap": true
93
+ }
94
+ ```
95
+
96
+ ### node-library.json
97
+
98
+ ```json
99
+ {
100
+ "lib": ["ES2024"],
101
+ "module": "NodeNext",
102
+ "moduleResolution": "NodeNext",
103
+ "target": "ES2024",
104
+ "declaration": true,
105
+ "declarationMap": true,
106
+ "sourceMap": true
107
+ }
108
+ ```
109
+
110
+ ### react.json
111
+
112
+ ```json
113
+ {
114
+ "lib": ["DOM", "DOM.Iterable", "ES2024"],
115
+ "module": "ESNext",
116
+ "moduleResolution": "Bundler",
117
+ "target": "ES2022",
118
+ "jsx": "react-jsx",
119
+ "declaration": true,
120
+ "sourceMap": true
121
+ }
122
+ ```
123
+
124
+ ### nextjs.json
125
+
126
+ ```json
127
+ {
128
+ "lib": ["DOM", "DOM.Iterable", "ES2024"],
129
+ "module": "ESNext",
130
+ "moduleResolution": "Bundler",
131
+ "target": "ES2022",
132
+ "jsx": "preserve",
133
+ "noEmit": true,
134
+ "incremental": true,
135
+ "allowJs": true,
136
+ "plugins": [{ "name": "next" }]
137
+ }
138
+ ```
139
+
140
+ ## Common tasks
141
+
142
+ ### Build an npm library
143
+
144
+ `tsconfig.json`:
63
145
 
64
146
  ```json
65
147
  {
66
148
  "extends": "@vllnt/typescript/node-library.json",
67
- "compilerOptions": {
68
- "outDir": "dist",
69
- "rootDir": "src",
70
- "types": ["node"]
71
- },
149
+ "compilerOptions": { "outDir": "dist", "rootDir": "src", "types": ["node"] },
72
150
  "include": ["src"]
73
151
  }
74
152
  ```
75
153
 
76
- ### React
154
+ The build writes `.js`, `.d.ts`, `.js.map` and `.d.ts.map` files. Without `"type": "module"` in `package.json`, NodeNext writes CommonJS.
155
+
156
+ ### Type-check a React app that Vite builds
157
+
158
+ `tsconfig.json`:
77
159
 
78
160
  ```json
79
161
  {
80
162
  "extends": "@vllnt/typescript/react.json",
81
- "compilerOptions": {
82
- "outDir": "dist",
83
- "rootDir": "src",
84
- "types": ["react"]
85
- },
163
+ "compilerOptions": { "noEmit": true, "types": ["react"] },
86
164
  "include": ["src"]
87
165
  }
88
166
  ```
89
167
 
90
- When a bundler such as Vite emits the JavaScript, replace `outDir` with `"noEmit": true` so `tsc` only type-checks.
168
+ `src/App.tsx`:
169
+
170
+ ```tsx
171
+ export function App() {
172
+ return <h1>Hello</h1>;
173
+ }
174
+ ```
175
+
176
+ To let `tsc` emit instead, replace `noEmit` with `"outDir": "dist"` and `"rootDir": "src"`.
177
+
178
+ ### Configure a Next.js app
91
179
 
92
- ### Next.js
180
+ `tsconfig.json`:
93
181
 
94
182
  ```json
95
183
  {
96
184
  "extends": "@vllnt/typescript/nextjs.json",
97
- "compilerOptions": {
98
- "types": ["node", "react"]
99
- },
185
+ "compilerOptions": { "types": ["node", "react"] },
100
186
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
101
187
  "exclude": ["node_modules"]
102
188
  }
103
189
  ```
104
190
 
105
- ## Base defaults
191
+ The integration test builds Next.js 16.4.6 with TypeScript 7.
106
192
 
107
- Every specialized preset inherits:
193
+ ### Keep TypeScript 6 for tools that need its JavaScript API
108
194
 
109
- - `strict: true`
110
- - `isolatedModules: true`
111
- - `noUncheckedIndexedAccess: true`
112
- - `noUncheckedSideEffectImports: true`
113
- - `noImplicitOverride: true`
114
- - `noImplicitReturns: true`
115
- - `noFallthroughCasesInSwitch: true`
116
- - `exactOptionalPropertyTypes: true`
117
- - `forceConsistentCasingInFileNames: true`
118
- - `skipLibCheck: true`
119
- - `esModuleInterop: true`
120
- - `resolveJsonModule: true`
121
- - `stableTypeOrdering: true`
122
- - `libReplacement: false`
123
- - `types: []`
195
+ `tsc` runs TypeScript 7 and `tsc6` runs TypeScript 6, so tools such as `typescript-eslint` can keep importing `typescript`. This is the [official side-by-side arrangement](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/). `package.json`:
124
196
 
125
- Ambient type packages are intentionally opt-in. List every required package in the consuming project's `types` array. Emitting projects must also set `rootDir` explicitly.
197
+ ```json
198
+ {
199
+ "devDependencies": {
200
+ "@typescript/native": "npm:typescript@^7.0.2",
201
+ "@vllnt/typescript": "^3.0.0",
202
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
203
+ }
204
+ }
205
+ ```
126
206
 
127
- `stableTypeOrdering` aligns TypeScript 6 output with TypeScript 7. It can make TypeScript 6 type-checking slower; TypeScript 7 always uses stable ordering.
207
+ ### Turn off one strictness flag
128
208
 
129
- ## Migrating from version 2
209
+ Set the flag after `extends`. `tsconfig.json`:
130
210
 
131
- Version 3 turns on four more flags in `base.json`, so every preset inherits them. Each one adds diagnostics, and none changes JavaScript output. `exactOptionalPropertyTypes` can change inferred declarations (see below). Run `tsc --noEmit` after upgrading and fix what it reports:
211
+ ```json
212
+ {
213
+ "extends": "@vllnt/typescript/nodejs.json",
214
+ "compilerOptions": {
215
+ "outDir": "dist",
216
+ "rootDir": "src",
217
+ "exactOptionalPropertyTypes": false
218
+ },
219
+ "include": ["src"]
220
+ }
221
+ ```
132
222
 
133
- | Flag | What it catches | Usual fix |
134
- | ---------------------------- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
135
- | `noImplicitOverride` | A method that replaces a base-class method without saying so (TS4114) | Add the `override` modifier, or rename the method if it was not meant to replace the base one. |
136
- | `noImplicitReturns` | A function that returns a value on some paths and falls off the end on others (TS7030) | Add the missing `return` (`return undefined;` if that is intended). |
137
- | `noFallthroughCasesInSwitch` | A non-empty `case` that runs into the next one (TS7029) | End the case with `break`, `return` or `throw`. Empty cases that share a body are still allowed. |
138
- | `exactOptionalPropertyTypes` | Assigning `undefined` to a property declared `prop?: T` (TS2375, TS2379, TS2322) | Write `prop?: T \| undefined` if `undefined` is a valid value, or leave the key out when there is no value. |
223
+ ### Migrating from version 2
139
224
 
140
- `exactOptionalPropertyTypes` is the one most likely to need many edits. `prop?: T` now means "the key may be missing", not "the value may be undefined":
225
+ Version 3 turns on `noImplicitOverride`, `noImplicitReturns`, `noFallthroughCasesInSwitch` and `exactOptionalPropertyTypes` in `base.json`. They add diagnostics and leave JavaScript output unchanged. Run `tsc --noEmit` and fix what it reports; [Errors and fixes](#errors-and-fixes) lists each code. Under `exactOptionalPropertyTypes`, `prop?: T` means "the key may be missing", not "the value may be undefined". `src/options.ts`:
141
226
 
142
227
  ```ts
143
228
  interface Options {
144
229
  name?: string;
145
230
  }
146
231
 
147
- const a: Options = { name: undefined }; // error
148
- const b: Options = {}; // omit the key
232
+ export const a: Options = { name: undefined }; // error
233
+ export const b: Options = {};
149
234
 
150
- function build(name: string | undefined): Options {
151
- return name === undefined ? {} : { name }; // add the key only when it is set
235
+ export function build(name: string | undefined): Options {
236
+ return name === undefined ? {} : { name };
152
237
  }
153
238
  ```
154
239
 
155
- The same applies to call arguments and to props you pass to libraries: `use({ name: undefined })` is an error when the parameter's type does not list `undefined`. Widen your own types, or build the object without the key.
156
-
157
- `exactOptionalPropertyTypes` also changes declaration emit. When TypeScript infers a type that has an optional property, it now prints `count?: number` where it used to print `count?: number | undefined`. Types you annotate yourself are copied as written. If you publish a library, compare the `.d.ts` files before and after upgrading.
158
-
159
- To adopt the flags one at a time, set the ones you are not ready for to `false` in your own `compilerOptions` (after `extends`) and remove the override as you fix each one. The [fixtures in `tests/fixtures/flags`](https://github.com/vllnt/typescript/tree/main/tests/fixtures/flags) show a failing and an accepted form of each pattern.
240
+ Inferred declarations can change: an optional property that version 2 emitted in declarations as `count?: number | undefined` is now emitted as `count?: number`. Libraries should compare their `.d.ts` output when upgrading. The [flag fixtures](https://github.com/vllnt/typescript/tree/main/tests/fixtures/flags) show a failing and an accepted form of each flag.
160
241
 
161
- ## Migrating from version 1
242
+ ### Migrating from version 1
162
243
 
163
- Version 2 supports TypeScript `>=6.0.2 <8` and drops TypeScript 5. Before upgrading:
244
+ Version 2 supports TypeScript `>=6.0.2 <8` and drops TypeScript 5:
164
245
 
165
246
  1. Remove `baseUrl` and make `paths` targets relative to the project root.
166
- 2. Replace legacy `moduleResolution: "node"` with `"NodeNext"` for Node.js or `"Bundler"` for bundled applications.
247
+ 2. Replace `moduleResolution: "node"` with `"NodeNext"` for Node.js or `"Bundler"` for bundled applications.
167
248
  3. Set `rootDir` in projects that emit files.
168
249
  4. List required ambient packages in `types`, such as `node` or `vitest/globals`.
169
- 5. Use Next.js 16.3 or newer when building with TypeScript 7.
170
- 6. Keep TypeScript 6 available through the side-by-side setup while ESLint or other tools require the legacy JavaScript API.
171
-
172
- TypeScript 7 also removes ES5 targeting, legacy module formats and resolution, `downlevelIteration`, and the ability to disable `esModuleInterop`, `allowSyntheticDefaultImports`, or strict mode.
250
+ 5. Use a Next.js release that builds with TypeScript 7; the integration test uses 16.4.6.
251
+ 6. Keep TypeScript 6 available side by side while ESLint or other tools require its JavaScript API.
252
+
253
+ ## Errors and fixes
254
+
255
+ The package runs no code and throws nothing. These are the compiler diagnostics that the presets cause or that commonly follow from them. `tests/docs.test.mjs` runs TypeScript 6 and 7 and reproduces each code with the compiler that reports it: the rows TS5102 / TS5101 and TS5108 / TS5107 give TypeScript 7's code first and TypeScript 6's second, and both compilers report every other code. It finds each message in the output of at least one of them.
256
+
257
+ | Code | Message contains | Cause | Fix |
258
+ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
259
+ | TS6053 | File '@vllnt/typescript/nodejs' not found | `extends` without `.json`, or the package is not installed (the message then names the specifier as written, such as `'@vllnt/typescript/nodejs.json'`) | Write the full export path, such as `@vllnt/typescript/nodejs.json`, and install the package |
260
+ | TS2591 | Cannot find name 'process'. Do you need to install type definitions for node? | `types: []` loads no `@types` package | Install `@types/node` and add `"node"` to `types` |
261
+ | TS5011 | The common source directory of 'tsconfig.json' is './src' | `outDir` without `rootDir` | Set `rootDir`, such as `"rootDir": "src"` |
262
+ | TS6059 | is not under 'rootDir' | `include` lists files outside `rootDir`, such as `tests/` next to `src/` | Type-check those files with a separate `tsconfig.json` that sets `noEmit`, or widen `rootDir` |
263
+ | TS2835 | Relative import paths need explicit file extensions in ECMAScript imports | NodeNext in a package with `"type": "module"` | Import `./file.js`, not `./file` |
264
+ | TS1309 | The current file is a CommonJS module and cannot use 'await' at the top level | Top-level `await` under NodeNext without `"type": "module"` | Add `"type": "module"` to `package.json`, or rename the file to `.mts` |
265
+ | TS5110 | Option 'module' must be set to 'NodeNext' when option 'moduleResolution' is set to 'NodeNext' | `module` overridden on `nodejs.json` or `node-library.json` | Override `module` and `moduleResolution` together, or extend `react.json` for bundled code |
266
+ | TS5109 / TS5095 | Option 'moduleResolution' must be set to 'NodeNext' (or left unspecified) when option 'module' is set to 'NodeNext' | `moduleResolution: "Bundler"` alone on `nodejs.json` or `node-library.json` | The same |
267
+ | TS5102 / TS5101 | Option 'baseUrl' has been removed / Option 'baseUrl' is deprecated | `baseUrl`, `downlevelIteration` or `outFile` in your `tsconfig.json` | Remove the option; make `paths` targets relative, and bundle instead of `outFile` |
268
+ | TS5108 / TS5107 | Option 'target=ES5' has been removed / Option 'target=ES5' is deprecated | A removed value: `target: "ES5"`, `moduleResolution: "node"` or `"classic"`, `esModuleInterop: false`, `allowSyntheticDefaultImports: false` | Remove the option, or use a supported value |
269
+ | TS5052 | Option 'exactOptionalPropertyTypes' cannot be specified without specifying option 'strictNullChecks' | `strict: false` (or `strictNullChecks: false`) while `exactOptionalPropertyTypes` is on | Also set `exactOptionalPropertyTypes: false` |
270
+ | TS17004 | Cannot use JSX unless the '--jsx' flag is provided | A `.tsx` file in a project on `nodejs.json`, `node-library.json` or `base.json` | Extend `react.json` or `nextjs.json`, or set `jsx` |
271
+ | TS2882 | Cannot find module or type declarations for side-effect import | `noUncheckedSideEffectImports` with an import such as `import "./styles.css"` | Fix the path, or declare the module, such as `declare module "*.css";`, or add `vite/client` to `types` |
272
+ | TS18048 / TS2532 | 'first' is possibly 'undefined' / Object is possibly 'undefined' | `noUncheckedIndexedAccess`: `array[0]` and `record[key]` have type `T \| undefined` | Check for `undefined` before use |
273
+ | TS4114 | This member must have an 'override' modifier | `noImplicitOverride` | Add `override` to the method, or rename it if it was not meant to replace the base method |
274
+ | TS7030 | Not all code paths return a value | `noImplicitReturns` | Return on every path, `return undefined;` if intended |
275
+ | TS7029 | Fallthrough case in switch | `noFallthroughCasesInSwitch` | End each non-empty `case` with `break`, `return` or `throw`; empty cases that share a body are allowed |
276
+ | TS2375 | Type '{ name: undefined; }' is not assignable to type 'Options' with 'exactOptionalPropertyTypes: true' | `exactOptionalPropertyTypes`: `undefined` given to `prop?: T` | Write `prop?: T \| undefined`, or leave the key out |
277
+ | TS2379 | Argument of type '{ name: undefined; }' is not assignable to parameter of type 'Options' with 'exactOptionalPropertyTypes: true' | The same, in a call argument | The same |
278
+ | TS2412 | Type 'undefined' is not assignable to type 'string' with 'exactOptionalPropertyTypes: true' | The same, in an assignment such as `options.name = undefined` | The same, or `delete options.name` |
279
+
280
+ ## Limits and gotchas
281
+
282
+ - The presets set no `outDir`, `rootDir`, `paths`, `include` or `files`. TypeScript resolves those relative to the file that sets them, so set them in your own `tsconfig.json`.
283
+ - `extends` must name an exported path with `.json`; `@vllnt/typescript/nodejs` fails with TS6053.
284
+ - `nodejs.json` and `node-library.json` use NodeNext: the nearest `package.json` `"type"` decides between ESM and CommonJS output for `.ts` files (`.mts` is always ESM, `.cts` always CommonJS), and ESM needs file extensions in relative imports.
285
+ - Emitting presets do not enable `incremental`, so a clean build emits every file even when a `.tsbuildinfo` is left over. If you set `incremental: true`, delete the `.tsbuildinfo` with the output directory before a clean build.
286
+ - `nextjs.json` keeps `incremental` because it sets `noEmit`. If you override `noEmit`, also set `incremental: false`.
287
+ - The `next` plugin in `nextjs.json` is an editor language-service plugin. `tsc` ignores it, and TypeScript 7 `--showConfig` leaves it out.
288
+ - `skipLibCheck: true` skips type errors inside `.d.ts` files, including those of dependencies.
289
+ - `strict: false` alone fails with TS5052, because `exactOptionalPropertyTypes` needs `strictNullChecks`. Also set `exactOptionalPropertyTypes: false`.
290
+ - TypeScript 7 removed `target: "ES5"`, `moduleResolution: "node"` and `"classic"`, `esModuleInterop: false`, `allowSyntheticDefaultImports: false` (TS5108), and `baseUrl`, `downlevelIteration` and `outFile` (TS5102). TypeScript 6 reports them as deprecated.
291
+ - Under `exactOptionalPropertyTypes`, an optional property whose type is inferred, which version 2 emitted in declarations as `count?: number | undefined`, is now emitted as `count?: number`. Types you annotate yourself are copied as written, so a written `count?: number | undefined` keeps `undefined`.
292
+ - Install the `@types/node` major that matches your Node.js runtime; 22 is the oldest supported.
173
293
 
174
294
  ## Compatibility
175
295
 
176
- | Surface | Supported version |
177
- | ---------------------- | -------------------------------------------------- |
178
- | Node.js consumers | `>=22` |
179
- | TypeScript | `>=6.0.2 <8` |
180
- | Tested compilers | TypeScript 6.0.2 (compatibility package) and 7.0.2 |
181
- | Next.js integration | 16.4.6 |
182
- | React integration | 19.3.1 |
183
- | Vite integration | 8.3.8 |
184
- | Repository development | Node.js 22.13+, pnpm 12.22.0 |
296
+ | Surface | Supported version |
297
+ | ---------------------- | -------------------------------------------------------------------------------- |
298
+ | TypeScript (peer) | `>=6.0.2 <8` |
299
+ | Node.js consumers | `>=22` |
300
+ | Tested compilers | TypeScript 7.0.2, and `@typescript/typescript6` 6.0.2 (its `tsc6` reports 6.0.3) |
301
+ | Next.js integration | 16.4.6 |
302
+ | React integration | 19.3.1 |
303
+ | Vite integration | 8.3.8 |
304
+ | Repository development | Node.js 22.13+, pnpm 12.22.0 |
305
+
306
+ The integration rows are the tested versions, not requirements.
185
307
 
186
- ## Development
308
+ ## Testing
187
309
 
188
310
  ```sh
189
311
  pnpm install --frozen-lockfile
@@ -191,7 +313,7 @@ pnpm check
191
313
  pnpm pack --dry-run
192
314
  ```
193
315
 
194
- The checks compile every preset with TypeScript 6 and 7, prove that each inherited strictness flag is active, verify declaration emit, install and compile the packed package, enforce full test-helper coverage, and build real React/Vite and Next.js fixtures.
316
+ The checks type-check the repository scripts and tests and compile every preset with TypeScript 6 and 7, prove that each inherited strictness flag is active, verify declaration emit, install and compile the packed package, check this README against the packed package, enforce full test-helper coverage, and build real React/Vite and Next.js fixtures.
195
317
 
196
318
  ## Versioning
197
319
 
@@ -200,27 +322,33 @@ The checks compile every preset with TypeScript 6 and 7, prove that each inherit
200
322
  - **Patch:** fixes, documentation, tests, or CI changes without consumer-visible behavior changes.
201
323
  - **Build-cache exception:** a patch may remove a build-cache default, such as `incremental`, that makes builds emit wrong or missing output. JavaScript, declaration, and source-map output of a clean build and all diagnostics must stay the same. The changelog states the cache effect and how to opt back in. 2.0.1 uses this exception.
202
324
 
203
- ## Documentation and support
325
+ npm `latest` is the newest stable release. `@canary` selects moving prereleases built from `main`; pin and test them before adoption. See the [changelog](CHANGELOG.md) and the [LLM index](llms.txt).
204
326
 
205
- - [LLM index](llms.txt) · [Changelog](CHANGELOG.md)
206
- - [Contributing](https://github.com/vllnt/typescript/blob/main/CONTRIBUTING.md) · [Issues](https://github.com/vllnt/typescript/issues)
207
- - [Security policy and private reporting](https://github.com/vllnt/typescript/blob/main/SECURITY.md)
327
+ ## Security
208
328
 
209
- npm `latest` is stable `3.0.0` at this audit. `@canary` selects moving prereleases;
210
- pin and test them before adoption. The compatibility matrix above describes
211
- this version's tested integrations, not a requirement to use every framework.
329
+ Report vulnerabilities privately as described in the [security policy](https://github.com/vllnt/typescript/blob/main/SECURITY.md).
212
330
 
213
331
  ## Related packages
214
332
 
215
- - [`@vllnt/eslint-config`](https://oss.vllnt.com/packages/eslint-config): strict ESLint presets for TypeScript projects. Use it for lint rules and `@vllnt/typescript` for compiler options; they are installed and configured separately.
333
+ - [`@vllnt/eslint-config`](https://oss.vllnt.com/packages/eslint-config): ESLint presets for TypeScript projects. It sets lint rules and `@vllnt/typescript` sets compiler options; each is installed and configured on its own. This repository uses both: `eslint.config.mjs` imports `@vllnt/eslint-config/nodejs` (a devDependency) and lints the scripts and tests.
334
+
335
+ ## Contributing
216
336
 
217
- ## Author
337
+ See [CONTRIBUTING.md](https://github.com/vllnt/typescript/blob/main/CONTRIBUTING.md) and the [issues](https://github.com/vllnt/typescript/issues).
218
338
 
219
- Built by [bntvllnt](https://github.com/bntvllnt) · [bntvllnt.com](https://bntvllnt.com).
220
- [Sponsor the work](https://github.com/sponsors/bntvllnt).
339
+ ## Links
340
+
341
+ - Docs and changelog: [oss.vllnt.com/packages/typescript](https://oss.vllnt.com/packages/typescript) · [release feed](https://oss.vllnt.com/packages/typescript/rss.xml)
342
+ - All @vllnt packages: [oss.vllnt.com](https://oss.vllnt.com) · [search packages and docs on index.vllnt.com](https://index.vllnt.com)
343
+ - Source and issues: [GitHub](https://github.com/vllnt/typescript) · [issues](https://github.com/vllnt/typescript/issues) · [npm](https://www.npmjs.com/package/@vllnt/typescript)
344
+ - Questions and updates: [Discord](https://bntvllnt.com/discord) · [X @bntvllnt](https://x.com/bntvllnt)
345
+ - Company and author: [vllnt.com](https://vllnt.com) · [bntvllnt.com](https://bntvllnt.com) · [GitHub @bntvllnt](https://github.com/bntvllnt) · [LinkedIn](https://linkedin.com/in/bntvllnt)
346
+ - Sponsor: [GitHub Sponsors](https://github.com/sponsors/bntvllnt)
221
347
 
222
348
  ## License
223
349
 
224
350
  [MIT](LICENSE)
225
351
 
226
- Part of vllnt oss: <https://oss.vllnt.com>
352
+ ---
353
+
354
+ Part of [vllnt open source](https://oss.vllnt.com) · [Package page](https://oss.vllnt.com/packages/typescript) · [vllnt.com](https://vllnt.com) · Built by [bntvllnt](https://bntvllnt.com)
package/llms.txt CHANGED
@@ -1,20 +1,33 @@
1
1
  # @vllnt/typescript
2
2
 
3
- > Strict shared TypeScript presets for Node.js, libraries, React, and Next.js, tested with TypeScript 6 and the native TypeScript 7 compiler.
3
+ > Shared tsconfig presets for Node.js apps, npm libraries, React and Next.js, with strict type-checking, tested with TypeScript 6 and 7.
4
4
 
5
5
  - npm: https://www.npmjs.com/package/@vllnt/typescript
6
6
  - Repository: https://github.com/vllnt/typescript
7
7
  - Documentation: [README](./README.md)
8
+ - API reference: [API](./README.md#api)
9
+ - Errors and fixes: [Errors and fixes](./README.md#errors-and-fixes)
8
10
  - Changelog: [CHANGELOG](./CHANGELOG.md)
9
11
  - License: MIT
10
12
 
11
13
  Install independently in any project; no vllnt monorepo is required. npm latest
12
- is stable 3.0.0 at this audit; canary is a moving prerelease channel. Pin and test
13
- prereleases. See [Contributing](https://github.com/vllnt/typescript/blob/main/CONTRIBUTING.md) and the [Security policy](https://github.com/vllnt/typescript/blob/main/SECURITY.md).
14
+ is the newest stable release; canary is a moving prerelease channel built from main.
15
+ Pin and test prereleases. See [Contributing](https://github.com/vllnt/typescript/blob/main/CONTRIBUTING.md) and the [Security policy](https://github.com/vllnt/typescript/blob/main/SECURITY.md).
14
16
 
15
17
  ## For coding agents
16
18
 
17
- The documentation ships inside the package: `node_modules/@vllnt/typescript/` contains `README.md`, `llms.txt` and `CHANGELOG.md` next to the preset files, and they match the installed version. Read them before writing a `tsconfig.json`.
19
+ The documentation ships inside the package: `node_modules/@vllnt/typescript/` contains `README.md`, `llms.txt` and `CHANGELOG.md` next to the preset files, and they match the installed version. The package contains only JSON presets for `extends`; there is no JavaScript or type export to import.
20
+
21
+ ## When to use
22
+
23
+ - Use it when one `extends` line should set the compiler options of a Node.js app, an npm library, a bundled React app or a Next.js app.
24
+ - Use it when the project compiles with TypeScript 7, or with TypeScript 6.0.2 or newer.
25
+ - Do not use it on TypeScript 5 or older, or for ES5 output (TypeScript 7 removed `target: "ES5"`): use a `@tsconfig/*` preset made for your TypeScript version and runtime, such as `@tsconfig/node22`, or your own `tsconfig.json`.
26
+ - Do not use it when the code cannot pass `strict`: write your own `tsconfig.json`. If only the extra flags fail, turn them off one at a time in your own `compilerOptions`.
27
+
28
+ ## Install
29
+
30
+ `pnpm add --save-dev @vllnt/typescript@^3 typescript@^7 @types/node@^22`, then extend one preset, such as `"extends": "@vllnt/typescript/nodejs.json"`.
18
31
 
19
32
  ## Compatibility
20
33
 
@@ -25,7 +38,7 @@ The documentation ships inside the package: `node_modules/@vllnt/typescript/` co
25
38
 
26
39
  ## Presets
27
40
 
28
- Extend one preset per project; every preset extends `base.json`.
41
+ Extend one preset per project; every preset extends `base.json`. Full option lists: [API](./README.md#api).
29
42
 
30
43
  - `@vllnt/typescript/base.json`: strict shared defaults and explicit ambient types; sets no `module`, `target` or `lib`
31
44
  - `@vllnt/typescript/nodejs.json`: Node.js applications; NodeNext, ES2024, emits declarations and source maps
@@ -38,21 +51,26 @@ Emitting presets do not enable `incremental`, so a clean build emits every outpu
38
51
 
39
52
  ## Strictness inherited from base.json
40
53
 
41
- Every preset enables `strict`, `noUncheckedIndexedAccess`, `noUncheckedSideEffectImports`, `noImplicitOverride`, `noImplicitReturns`, `noFallthroughCasesInSwitch` and `exactOptionalPropertyTypes`.
54
+ Every preset enables `strict`, `noUncheckedIndexedAccess`, `noUncheckedSideEffectImports`, `noImplicitOverride`, `noImplicitReturns`, `noFallthroughCasesInSwitch` and `exactOptionalPropertyTypes`. The diagnostic codes and fixes are in [Errors and fixes](./README.md#errors-and-fixes).
42
55
 
43
56
  Migrating from version 2 (the last four flags are new):
44
57
 
45
58
  - `noImplicitOverride` (TS4114): add `override` to a method that replaces a base-class method.
46
59
  - `noImplicitReturns` (TS7030): return on every path; use `return undefined;` when that is intended.
47
60
  - `noFallthroughCasesInSwitch` (TS7029): end a non-empty `case` with `break`, `return` or `throw`.
48
- - `exactOptionalPropertyTypes` (TS2375, TS2379, TS2322): write `prop?: T | undefined` where `undefined` is a valid value, or omit the key.
49
- - JavaScript output does not change. Under `exactOptionalPropertyTypes`, inferred declarations can: `count?: number | undefined` is emitted as `count?: number`.
61
+ - `exactOptionalPropertyTypes` (TS2375, TS2379, TS2412): write `prop?: T | undefined` where `undefined` is a valid value, or omit the key.
62
+ - JavaScript output does not change. Under `exactOptionalPropertyTypes`, inferred declarations can: an optional property that version 2 emitted in declarations as `count?: number | undefined` is now emitted as `count?: number`. A type written as `number | undefined` keeps `undefined`.
50
63
  - To adopt them gradually, set a flag to `false` in the project's own `compilerOptions` after `extends`.
51
64
 
52
65
  ## Related packages
53
66
 
54
- - [@vllnt/eslint-config](https://oss.vllnt.com/packages/eslint-config): strict ESLint presets for TypeScript projects; lint rules, configured separately from these compiler presets.
67
+ - [@vllnt/eslint-config](https://oss.vllnt.com/packages/eslint-config): ESLint presets for TypeScript projects. It sets lint rules and these presets set compiler options; each is installed and configured on its own. This repository uses both: `eslint.config.mjs` imports `@vllnt/eslint-config/nodejs` (a devDependency) and lints the scripts and tests.
55
68
 
56
69
  ## Ecosystem
57
70
 
58
- - vllnt oss index: https://oss.vllnt.com/llms.txt
71
+ - [Package page](https://oss.vllnt.com/packages/typescript)
72
+ - [Release feed](https://oss.vllnt.com/packages/typescript/rss.xml)
73
+ - [All @vllnt packages](https://oss.vllnt.com/llms.txt)
74
+ - [Search vllnt packages and docs](https://index.vllnt.com)
75
+ - [vllnt](https://vllnt.com/llms.txt)
76
+ - [Author](https://bntvllnt.com)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vllnt/typescript",
3
- "version": "3.0.1-canary.4a7b45d",
4
- "description": "Shared TypeScript configurations for vllnt projects",
3
+ "version": "3.0.1-canary.a2c7289",
4
+ "description": "Shared tsconfig presets for Node.js apps, npm libraries, React and Next.js, with strict type-checking, tested with TypeScript 6 and 7.",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "bntvllnt",
@@ -22,11 +22,15 @@
22
22
  "keywords": [
23
23
  "typescript",
24
24
  "tsconfig",
25
- "config",
25
+ "tsconfig-base",
26
+ "typescript-config",
26
27
  "shared-config",
28
+ "strict",
27
29
  "nodejs",
28
30
  "react",
29
- "nextjs"
31
+ "nextjs",
32
+ "vite",
33
+ "typescript-7"
30
34
  ],
31
35
  "packageManager": "pnpm@12.22.0",
32
36
  "engines": {
@@ -57,9 +61,10 @@
57
61
  "test": "vitest run",
58
62
  "test:coverage": "vitest run --coverage",
59
63
  "test:integration": "pnpm --dir tests/integration/react build && pnpm --dir tests/integration/nextjs build",
60
- "check": "pnpm format:check && pnpm lint && pnpm test:coverage && pnpm test:integration && pnpm test:package",
64
+ "check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm test:coverage && pnpm test:integration && pnpm test:package",
61
65
  "check:agents": "node -e \"const f=require('node:fs');if(!f.existsSync('AGENTS.md')||f.existsSync('CLAUDE.md')||f.existsSync('.claude'))process.exit(1)\"",
62
- "test:package": "bash scripts/test-check-package-contents.sh && bash scripts/check-package-contents.sh"
66
+ "test:package": "bash scripts/test-check-package-contents.sh && bash scripts/check-package-contents.sh",
67
+ "typecheck": "tsc --project tsconfig.json && tsc6 --project tsconfig.json"
63
68
  },
64
69
  "peerDependencies": {
65
70
  "typescript": ">=6.0.2 <8"