@jmlweb/tsconfig-base 1.0.2 → 1.0.3

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 (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +172 -0
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @jmlweb/tsconfig-base
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 6b73301: Add changelog section with link to CHANGELOG.md in package READMEs
8
+
3
9
  ## 1.0.2
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -21,6 +21,8 @@
21
21
  npm install --save-dev @jmlweb/tsconfig-base typescript
22
22
  ```
23
23
 
24
+ > 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
25
+
24
26
  ## 🚀 Quick Start
25
27
 
26
28
  Create a `tsconfig.json` file in your project root:
@@ -241,10 +243,180 @@ See real-world usage examples:
241
243
 
242
244
  ## 🔗 Related Packages
243
245
 
246
+ ### Internal Packages
247
+
244
248
  - [`@jmlweb/eslint-config-base`](../eslint-config-base) - ESLint configuration for TypeScript projects
245
249
  - [`@jmlweb/prettier-config-base`](../prettier-config-base) - Prettier configuration
246
250
  - [`@jmlweb/tsconfig-react`](../tsconfig-react) - TypeScript configuration for React projects
247
251
 
252
+ ### External Tools
253
+
254
+ - [TypeScript](https://www.typescriptlang.org/) - Strongly typed programming language that builds on JavaScript
255
+ - [ts-node](https://typestrong.org/ts-node/) - TypeScript execution engine for Node.js
256
+ - [tsx](https://github.com/privatenumber/tsx) - Fast TypeScript/ESM execution (alternative to ts-node)
257
+ - [ESLint](https://eslint.org/) - Linter for TypeScript (use with @jmlweb/eslint-config-base)
258
+
259
+ ## ⚠️ Common Issues
260
+
261
+ > **Note:** This section documents known issues and their solutions. If you encounter a problem not listed here, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
262
+
263
+ ### Missing File Extensions Error
264
+
265
+ **Symptoms:**
266
+
267
+ - Error: "Relative import paths need explicit file extensions in ECMAScript imports"
268
+ - Import statements like `import { foo } from './bar'` fail
269
+
270
+ **Cause:**
271
+
272
+ - This config uses `moduleResolution: "NodeNext"` which follows Node.js ESM rules
273
+ - Node.js requires explicit `.js` extensions in import statements (even for `.ts` files)
274
+
275
+ **Solution:**
276
+
277
+ Add `.js` extensions to your imports (TypeScript will resolve to `.ts` files):
278
+
279
+ ```typescript
280
+ // Before
281
+ import { foo } from './bar';
282
+
283
+ // After
284
+ import { foo } from './bar.js';
285
+ ```
286
+
287
+ Or switch to a bundler-based module resolution:
288
+
289
+ ```json
290
+ {
291
+ "extends": "@jmlweb/tsconfig-base",
292
+ "compilerOptions": {
293
+ "module": "ESNext",
294
+ "moduleResolution": "bundler"
295
+ }
296
+ }
297
+ ```
298
+
299
+ ### Module and ModuleResolution Mismatch
300
+
301
+ **Symptoms:**
302
+
303
+ - Error: "Option 'module' must be set to 'NodeNext' when 'moduleResolution' is 'NodeNext'"
304
+ - Type errors related to module resolution
305
+
306
+ **Cause:**
307
+
308
+ - Both `module` and `moduleResolution` must be set to compatible values
309
+ - This config uses `NodeNext` for both
310
+
311
+ **Solution:**
312
+
313
+ If you need to override the module system, update both options together:
314
+
315
+ ```json
316
+ {
317
+ "extends": "@jmlweb/tsconfig-base",
318
+ "compilerOptions": {
319
+ "module": "ESNext",
320
+ "moduleResolution": "bundler"
321
+ }
322
+ }
323
+ ```
324
+
325
+ ### CommonJS vs ESM Mismatch
326
+
327
+ **Symptoms:**
328
+
329
+ - Code runs but module resolution is incorrect
330
+ - `require` statements in output when you expected `import`
331
+
332
+ **Cause:**
333
+
334
+ - Your `package.json` has `"type": "module"` but your build uses CommonJS
335
+ - Or vice versa
336
+
337
+ **Solution:**
338
+
339
+ Match your `package.json` to your build output:
340
+
341
+ ```json
342
+ // package.json
343
+ {
344
+ "type": "module" // For ESM output (this config's default)
345
+ }
346
+ ```
347
+
348
+ Or override to CommonJS:
349
+
350
+ ```json
351
+ // tsconfig.json
352
+ {
353
+ "extends": "@jmlweb/tsconfig-base",
354
+ "compilerOptions": {
355
+ "module": "CommonJS",
356
+ "moduleResolution": "node"
357
+ }
358
+ }
359
+ ```
360
+
361
+ ### Index Signature Type Errors
362
+
363
+ **Symptoms:**
364
+
365
+ - Error: "Object is possibly 'undefined'" when accessing object properties
366
+ - Example: `obj[key]` shows type `T | undefined`
367
+
368
+ **Cause:**
369
+
370
+ - This config enables `noUncheckedIndexedAccess` for extra safety
371
+ - TypeScript correctly adds `undefined` to index access types
372
+
373
+ **Solution:**
374
+
375
+ Use optional chaining or explicit checks:
376
+
377
+ ```typescript
378
+ // Before
379
+ const value = obj[key].toString();
380
+
381
+ // After - option 1: optional chaining
382
+ const value = obj[key]?.toString();
383
+
384
+ // After - option 2: explicit check
385
+ if (obj[key] !== undefined) {
386
+ const value = obj[key].toString();
387
+ }
388
+
389
+ // After - option 3: type assertion (use sparingly)
390
+ const value = obj[key]!.toString();
391
+ ```
392
+
393
+ Or disable this strict check:
394
+
395
+ ```json
396
+ {
397
+ "extends": "@jmlweb/tsconfig-base",
398
+ "compilerOptions": {
399
+ "noUncheckedIndexedAccess": false
400
+ }
401
+ }
402
+ ```
403
+
404
+ ## 🔄 Migration Guide
405
+
406
+ ### Upgrading to a New Version
407
+
408
+ > **Note:** If no breaking changes were introduced in a version, it's safe to upgrade without additional steps.
409
+
410
+ **No breaking changes have been introduced yet.** This package follows semantic versioning. When breaking changes are introduced, detailed migration instructions will be provided here.
411
+
412
+ For version history, see the [Changelog](./CHANGELOG.md).
413
+
414
+ **Need Help?** If you encounter issues during migration, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
415
+
416
+ ## 📜 Changelog
417
+
418
+ See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
419
+
248
420
  ## 📄 License
249
421
 
250
422
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jmlweb/tsconfig-base",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Base TypeScript configuration with strict type checking and modern defaults",
5
5
  "main": "tsconfig.json",
6
6
  "exports": {