Fix type checking of skin-database

This commit is contained in:
Jordan Eldredge 2025-07-06 16:33:09 -07:00
parent 8abcf9d139
commit b99ea291eb
10 changed files with 93 additions and 50 deletions

View file

@ -6,15 +6,19 @@ This document describes the TypeScript checking convention established for the W
Each TypeScript-enabled package in the monorepo now has a consistent `type-check` script that performs type checking without emitting files.
**Progress: 4 out of 5 packages now passing! 🎉**
### Package Status
#### ✅ Passing Packages
- **webamp**: Clean TypeScript compilation
- **ani-cursor**: Clean TypeScript compilation
- **webamp-docs**: Clean TypeScript compilation (after adding webamp workspace dependency)
- **skin-database**: Clean TypeScript compilation (fixed JSZip types, Jest types, and Buffer compatibility issues)
- **webamp-docs**: Clean TypeScript compilation
#### ❌ Failing Packages (Need fixes)
- **skin-database**: 172 TypeScript errors (missing types, test setup issues)
- **webamp-modern**: 390+ TypeScript errors (conflicting type definitions, target issues)
## Convention
@ -40,7 +44,7 @@ The root package.json contains a centralized script that runs type checking for
```json
{
"scripts": {
"type-check": "pnpm --filter webamp type-check && pnpm --filter ani-cursor type-check && pnpm --filter webamp-docs type-check"
"type-check": "pnpm --filter webamp type-check && pnpm --filter ani-cursor type-check && pnpm --filter skin-database type-check && pnpm --filter webamp-docs type-check"
}
}
```
@ -69,19 +73,28 @@ When adding a new TypeScript package to the type-check convention:
### Common Issues
1. **Missing Jest types** (`skin-database`):
1. **Missing Jest types** (Fixed in `skin-database`):
- Install `@types/jest` and configure proper Jest setup
- Ensure test files are properly configured
2. **Conflicting type definitions** (`webamp-modern`):
2. **Missing package types** (Fixed in `skin-database`):
- Install missing dependencies like `jszip`, `react-redux`, `express`
- Install corresponding `@types/` packages where needed
- Note: Some packages like JSZip provide their own types
3. **Buffer compatibility issues** (Fixed in `skin-database`):
- Newer TypeScript versions require explicit casting for `fs.writeFileSync`
- Use `new Uint8Array(buffer)` instead of raw `Buffer` objects
4. **Conflicting type definitions** (`webamp-modern`):
- Multiple versions of `@types/node` causing conflicts
- Target configuration issues (ES5 vs ES2015+)
- Dependency type mismatches
3. **Missing dependencies**:
- Missing type definitions for imported modules
- Incorrect dependency references
### Recommended Fix Strategy
1. Start with packages that have fewer errors