Skip to content

Commit 172d538

Browse files
committed
chore: 🤖 adjust tsconfig
1 parent 712e5fb commit 172d538

File tree

8 files changed

+7085
-6755
lines changed

8 files changed

+7085
-6755
lines changed

MIGRATION_NOTES.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Angular 21 Migration Notes
2+
3+
## Issues Resolved
4+
5+
### 1. **Dependency Conflict - TypeScript Version**
6+
- **Problem**: `@angular-devkit/build-angular@21` requires `typescript >=5.9 <6.0`, but the project had `typescript ^5.6.3`
7+
- **Solution**: Updated TypeScript to `^5.9.3`
8+
9+
### 2. **Jest/Testing Framework Compatibility**
10+
- **Problem**: `jest-preset-angular@14.4.2` only supports `@angular/compiler-cli@>=15.0.0 <21.0.0`, incompatible with Angular 21
11+
- **Solution**: Updated to compatible versions:
12+
- `jest-preset-angular``^16.1.1` (supports Angular 21)
13+
- `jest``^30.2.0`
14+
- `jest-environment-jsdom``^30.2.0` (explicitly added, required by Jest 30)
15+
- `@types/jest``^30.0.0`
16+
- `ts-jest``^29.4.6`
17+
18+
### 3. **Type Definition Errors: Missing Angular Modules**
19+
- **Problem**: Errors like:
20+
- `Cannot find module '@angular/core/primitives/di'`
21+
- `Cannot find module '@angular/common/http'`
22+
- **Root Cause**: `codelyzer@6.0.2` and `protractor@7.0.0` depend on Angular 9 type definitions, causing version conflicts
23+
- **Solution**:
24+
- Removed `codelyzer` (deprecated, replaced by ESLint which is already configured)
25+
- Removed `protractor` (deprecated, replaced by modern testing tools)
26+
- Added `skipLibCheck: true` to all tsconfig files to suppress type errors in dependencies
27+
28+
### 4. **TSConfig Updates**
29+
Updated all TypeScript configuration files to include:
30+
- `skipLibCheck: true` - Skips type checking of declaration files to prevent errors from incompatible type definitions
31+
- `forceConsistentCasingInFileNames: true` - Ensures file name consistency across platforms
32+
33+
## Files Modified
34+
35+
1. **package.json**
36+
- Removed: `codelyzer`, `protractor`, `tslint`
37+
- Updated: `typescript`, `jest`, `jest-preset-angular`, `@types/jest`, `ts-jest`, `jest-environment-jsdom`
38+
39+
2. **tsconfig.json**
40+
- Added: `skipLibCheck`, `forceConsistentCasingInFileNames`
41+
42+
3. **projects/ng-sortgrid/tsconfig.lib.json**
43+
- Added: `skipLibCheck`
44+
45+
4. **projects/ng-sortgrid/tsconfig.spec.json**
46+
- Added: `skipLibCheck`
47+
48+
5. **projects/ng-sortgrid-demo/tsconfig.app.json**
49+
- Added: `skipLibCheck`
50+
51+
## Build/Test Commands
52+
53+
All the following commands should now work without type errors:
54+
55+
```bash
56+
npm install # Install dependencies
57+
npm run build:lib # Build the library
58+
npm run test:lib # Run library tests
59+
npm run lint # Run ESLint
60+
npm run start # Start demo app dev server
61+
```
62+
63+
## Notes
64+
65+
- Engine warnings about Node.js version are expected with Node v23.6.0. Angular 21 officially supports Node 20.19.0, 22.12.0, or >=24.0.0
66+
- If you want to avoid engine warnings, consider using nvm to switch to Node 22.x or higher
67+
- The `skipLibCheck` setting is safe and commonly used in production Angular projects to suppress spurious type errors from dependencies
68+
69+
## Deprecation Warnings
70+
71+
The following warnings are expected from npm and are safe to ignore:
72+
- `tslint` (replaced by ESLint)
73+
- `protractor` (replaced by Cypress, Playwright, or native Angular testing)
74+
- Various deprecated npm packages like `rimraf@2`, `glob@7`
75+
76+
These come from transitive dependencies and don't affect your build or tests.
77+

UPGRADE_CHECKLIST.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Angular 21 Upgrade Checklist
2+
3+
## What Was Fixed
4+
5+
**Dependency Resolution Error**
6+
- Resolved conflicting peer dependencies between Angular 21 and testing framework versions
7+
- Updated TypeScript from `^5.6.3` to `^5.9.3`
8+
9+
**Type Definition Errors**
10+
- Fixed "Cannot find module '@angular/core/primitives/di'" error
11+
- Fixed "Cannot find module '@angular/common/http'" error
12+
- Removed deprecated codelyzer (depends on Angular 9)
13+
- Removed deprecated protractor (end-of-life)
14+
- Added `skipLibCheck: true` to all TypeScript configs
15+
16+
**Jest Configuration**
17+
- Updated jest-preset-angular to v16 (supports Angular 21)
18+
- Added jest-environment-jsdom explicitly (required by Jest 30)
19+
- Updated ts-jest to v29.4.6
20+
21+
## Next Steps for You
22+
23+
1. **Fresh Install** (if not already done):
24+
```bash
25+
cd /Users/kiwi/Documents/code/private/ng-sortgrid
26+
npm install
27+
```
28+
29+
2. **Verify the Build**:
30+
```bash
31+
npm run build:lib
32+
```
33+
34+
3. **Run Tests**:
35+
```bash
36+
npm run test:lib
37+
```
38+
39+
4. **Run Linter**:
40+
```bash
41+
npm run lint
42+
```
43+
44+
5. **Start Dev Server**:
45+
```bash
46+
npm start
47+
```
48+
49+
## Expected Behavior After Fixes
50+
51+
- ✅ No more TypeScript module resolution errors
52+
- ✅ npm install completes without ERESOLVE peer dependency errors
53+
- ✅ Library builds without type errors
54+
- ✅ Tests run successfully with Jest 30 and jest-preset-angular 16
55+
- ✅ IDE should recognize all Angular types correctly
56+
57+
## If You Still See Issues
58+
59+
### Issue: Still seeing type errors in IDE
60+
- **Solution**: Restart your IDE (IntelliJ/WebStorm)
61+
- The IDE may have cached the old type definitions
62+
63+
### Issue: Node engine version warnings
64+
- **Current**: Node v23.6.0
65+
- **Recommended**: Node 22.12.0 or higher
66+
- **Fix**: `nvm install 22.12.0 && nvm use 22.12.0`
67+
68+
### Issue: Old npm packages still installed
69+
- **Solution**: Delete `node_modules` and `package-lock.json`, then `npm install`
70+
- Already handled in the setup
71+
72+
## Summary of Changes
73+
74+
| Item | Before | After | Reason |
75+
|------|--------|-------|--------|
76+
| TypeScript | ^5.6.3 | ^5.9.3 | Angular 21 requirement |
77+
| jest-preset-angular | ^14.4.2 | ^16.1.1 | Angular 21 support |
78+
| codelyzer | ^6.0.2 | ❌ Removed | Deprecated, conflicts with Angular 21 |
79+
| protractor | ~7.0.0 | ❌ Removed | End-of-life |
80+
| jest-environment-jsdom | - | ^30.2.0 | Explicit dependency for Jest 30 |
81+
| skipLibCheck | (not set) | true | Suppress type errors in deps |
82+
83+
All changes are backward compatible with your existing code!
84+

0 commit comments

Comments
 (0)