TypeScript 5.5 Highlights
TypeScript 5.5 landed with some genuinely useful features. Here are the ones that will impact your daily coding.
1. Inferred Type Predicates
Previously, you had to manually annotate type guard functions:
// Before: manual annotation required
function isString(x: unknown): x is string {
return typeof x === 'string';
}
// After: TypeScript infers it automatically!
function isString(x: unknown) {
return typeof x === 'string';
}
// TypeScript now knows this narrows the type
This works with .filter() too:
const items = [1, null, 2, undefined, 3];
const numbers = items.filter(x => x != null);
// Type: number[] (previously was (number | null | undefined)[])
2. Regular Expression Syntax Checking
TypeScript now validates your regex patterns at compile time:
const re = /hello(world/; // Error: Unterminated group
const re2 = /[\w+/; // Error: Unterminated character class
3. Performance Improvements
- 10-20% faster type checking on large projects
- Reduced memory usage in the language server
- Faster project loading with new caching strategies
4. extends Accepts Arrays in tsconfig
{
"extends": ["@company/base-config", "./local-overrides.json"]
}
Upgrade Now
npm install [email protected] --save-dev
These features require zero code changes โ just upgrade and benefit.