Compile-time Errors Overview
Instant Detection
On API changes Compile-time errors
Runtime Safety
Discover before deploy Production stability
IDE Integration
Red underlines Immediate feedback
Safe Refactoring
Large-scale changes Impact range visibility
What are Compile-time Errors?
Problem: Errors Only Discovered at Runtime
In traditional development, API changes are only discovered at runtime.- Occurs in production: Users experience directly
- Delayed discovery: Only discovered via QA or user reports
- Hard to debug: Need to trace where problem occurred
- Trust degradation: Service stability decreases
Solution: Compile-time Errors
Sonamu detects API changes immediately at compile time.- β¨ Instant discovery: IDE shows immediately while coding
- β¨ Fix before deploy: Resolve all issues before production deploy
- β¨ Impact range visibility: See all places affected by change
- β¨ Auto refactoring: Use IDEβs Rename feature
Error Detection Scenarios
1. Field Name Change
2. Field Type Change
3. Required/Optional Change
4. Field Deletion
5. Parameter Change
6. Return Type Change
Refactoring Support
Large-scale Changes are Safe
You can immediately identify all locations affected by API changes.- Check all errors in IDEβs βProblemsβ panel
- Visit each location and fix to match new structure
- When all errors are resolved, compilation succeeds
- Deploy safely
Leverage IDEβs Auto Refactoring
You can utilize TypeScriptβs powerful refactoring features. Example: Batch Field Name Change- Check type definition in Service file
- Position cursor on field name
- F2 (Rename Symbol) or right-click β Rename
- Enter new name
- All usages are automatically changed
Practical Workflow
1. Backend API Change
2. Service Regeneration
3. TypeScript Compile
4. Fix Errors
5. Re-verify
6. Deploy Safely
All type errors are resolved, so you can deploy safely.CI/CD Integration
Add TypeScript Check to CI
- Auto-detect type errors in Pull Requests
- Block merge if type errors exist
- Ensure code quality across the team
Best Practices
1. Regular Service Regeneration
2. Pre-commit Hook Setup
3. VSCode Settings
4. Donβt Ignore Type Errors
@ts-ignore. Type errors indicate real problems.
Understanding Error Messages
Common Error Messages
1. Property does not existCautions
Next Steps
API Type Inference
Understanding type inference
Shared Types
Type file structure
Using Services
Service usage
Testing
Writing tests