Course contentsShow
← JavaScript
Lesson 2105 of 2,72343. DecoratorsFree lesson

When You Might Still See Legacy Decorators

Recognizing legacy decorator syntax in older codebases and understanding why some projects still use it.

When You Might Still See Legacy Decorators

You'll learn where and why you still encounter the older decorator syntax in real-world projects.

Even though Stage 3 decorators are the modern standard, you'll frequently run into legacy (experimental) decorators in existing codebases. Understanding when and why they persist helps you navigate real projects without confusion.

Where Legacy Decorators Live

Older TypeScript Projects: Many applications were built between 2015 and 2022 when only experimental decorators existed. These projects have "experimentalDecorators": true in their tsconfig.json and haven't migrated yet.

Major Framework Ecosystems: Popular libraries like Angular, NestJS, and TypeORM were built entirely on legacy decorators. Migrating millions of lines of code is a massive undertaking, so these ecosystems continue using the old syntax while planning gradual transitions.

Enterprise Applications: Large companies often have strict stability requirements. If experimental decorators work reliably in production, there's less urgency to refactor working code—especially when the change requires updating every decorator throughout a massive codebase.

Why They Haven't Disappeared

Migration Complexity: The two decorator systems have different signatures and behaviors. Automated migration isn't always possible, requiring careful manual review of each decorator.

Dependency Lock-In: If your project depends on libraries using legacy decorators, you're tied to that syntax until those libraries update.

Stability Over Novelty: Teams prioritize feature delivery over syntax modernization. Legacy decorators work fine, so updating isn't urgent unless you need new capabilities.

What This Means for You

When you see "experimentalDecorators": true or encounter decorators with descriptors as parameters, you're dealing with legacy syntax. Don't assume the code is wrong—it's simply using an older, still-functional approach. Understanding both systems makes you a more versatile developer.

Key Takeaway: Legacy decorators remain common in TypeScript codebases, major frameworks, and enterprise applications due to migration costs and dependency constraints—expect to encounter both syntaxes in professional development.