Your Framework's Decorators Still Need experimentalDecorators
TypeScript 5 shipped real, standardized decorators with no flag required — but if your framework injects constructor parameters, deleting experimentalDecorators breaks it, and that's permanent, not a migration lag.

You're tidying up tsconfig.json. experimentalDecorators: true has been sitting there since someone copy-pasted it from a tutorial two years ago, and it looks like exactly the kind of thing worth deleting — TypeScript 5 has had real, standardized decorators for a while now, no flag required. You remove the line, save, and run the build.
It goes red in nineteen places. Every one of them is a NestJS service, and every error traces back to a constructor argument.
Nothing about that message mentions "legacy" or "standard" decorators. It just says the decorator isn't valid in that position anymore — which is technically true, and tells you nothing about why a flag you just deleted was the thing holding your dependency injection together.
Here's the reasoning, and it's not unreasonable: decorators spent years in TC39 limbo, TypeScript shipped them early and gated them behind experimentalDecorators as a warning label, and in March 2023 TypeScript 5.0 added support for the real, Stage 3 ECMAScript decorators proposal — on by default, no flag at all. "Experimental" sounds temporary. "Standardized" sounds like the upgrade path. Delete the old flag, get the new thing. That's how every other experimentalX flag in tsconfig.json has worked.
Except decorators aren't one feature with two flag states. They're two different features that happen to share a syntax (@something), and only one of the two was ever submitted to TC39.
Open the actual TC39 decorators proposal and look at what it lets you attach a decorator to: classes, methods, getters, setters, and fields (including the new accessor keyword for auto-accessors). That's the complete list. Constructor and method parameters aren't in it — not deprioritized, not planned for a later stage, just never part of the proposal TC39 advanced.
That's a problem for a specific, common pattern: frameworks that figure out what to inject by decorating constructor parameters.
@Inject(CONFIG_TOKEN) is a parameter decorator. There is no standard-decorators equivalent — not a different syntax, not a config flag, nothing. The new spec's decorator function signature is (value, context), built for wrapping a class, a method, or a field. A constructor parameter was never something the proposal gave you a way to describe.
So when you turn experimentalDecorators off, TypeScript isn't "modernizing" that decorator. It's telling you the position you put it in no longer accepts one, because under the new rules, it never did.
Two things point the same direction and both happen to be wrong.
First, experimentalDecorators sounds provisional by name — and for years it was, in the sense that some decorators feature was always going to graduate out of it eventually. One did. TypeScript's release notes announced "decorators" shipping in 5.0 without the headline distinguishing which half of the old functionality survived the trip through TC39.
Second, most teams meet decorators through a framework, not through the language spec. If you've only ever written @Injectable() and @Inject(), every decorator you've used looks like one feature. There's no moment where the framework tells you "by the way, three of these four decorator kinds have a TC39-standard twin and one doesn't" — you find out when you delete a flag and the build breaks on exactly the one kind that doesn't.
Stop thinking of experimentalDecorators: true → false as a version bump. Treat them as two separate decorator implementations that happen to share an @ symbol:
Legacy (experimentalDecorators: true) | Standard (TC39, default since TS 5.0) | |
|---|---|---|
| Decorator signature | (target, propertyKey, descriptor) | (value, context) |
| Can decorate | class, method, accessor, property, parameter | class, method, getter/setter, field/accessor — no parameters |
| Metadata | emitDecoratorMetadata + reflect-metadata, read via Reflect.getMetadata | a separate, still-settling Symbol.metadata proposal — not the same mechanism |
| Needs a flag? | Yes, experimentalDecorators: true | No — it's what you get by default |
Frameworks whose dependency injection runs through constructor parameters — NestJS and Angular are the two you've most likely used — are built on the legacy system specifically because it's the only one with parameter decorators. That's not these frameworks lagging behind; migrating their DI off constructor parameters would mean redesigning how every existing app wires its services. experimentalDecorators: true in their generated tsconfig.json isn't a leftover setting. It's a requirement with no newer substitute, because the newer spec was never designed to cover this case.
Try the flip side in the playground below: pick "method decorator" instead of "constructor injection," and the exact same toggle that broke the build a second ago compiles clean either way — because a method decorator is one of the cases both systems actually support.
Runs right in your browser — poke at it and watch the concept react live.
This isn't an argument for leaving experimentalDecorators: true everywhere out of caution. If your decorators are method- or class-level — a @Memoize() cache wrapper, a @LogExecutionTime() on a method, MobX's @observable on a field — none of that touches a constructor parameter, and the standard decorators handle it natively. Converting that code is a real decorators 5.0 migration, not an identity crisis, and it drops you to zero legacy flags with nothing structurally in the way.
The test is narrow and mechanical: grep your codebase for a decorator sitting inside a constructor's parameter list. If there's nothing there, flip the flag and watch the build stay green. If there is, that flag isn't debt — it's load-bearing, and it stays until something gives constructor parameters a standard decorator of their own. There's a TC39 proposal for exactly that, Class Method Parameter Decorators — but it's been stuck at Stage 1 since it was last presented in March 2023, so there's no migration path you can actually plan around today.
Think it clicked? Take the 8-question quiz →
Instant feedback, a hint on every question, and an explanation for each answer — right or wrong.
Go check your own tsconfig.json. Is experimentalDecorators sitting in there because nobody's gotten around to removing it — or because something in your constructors genuinely needs it? I'd bet a fair number of you find out it's the second one.
- NestJS 12: Standard Schema Validation Without class-validator
- TypeScript Generics: The Complete Guide (with Cheat Sheet)
- My Reducer's Switch Stopped Being Exhaustive.
as constFixed It.
🚀 Want more like this? Every guide, playground, and quiz lives on bestpractic.org — open it and sign up free so the next one finds you.
Thanks for reading! Let's stay connected:
- ⭐ GitHub — follow me and star the projects: github.com/parsajiravand
- 💬 Discord — join the frontend best-practices community: discord.gg/d9KRhuAwQ
- 📸 Instagram — frontend best practices, daily: @bestpractice___
Keep reading
One post a day, in your inbox
Each one with a runnable playground and a quiz. No pitch, no digest, unsubscribe in one click.
0 comments
Sign in to join the discussion, like comments, and save articles for later.