TS1249
TypeScriptERRORNotableSyntaxHIGH confidence

A decorator can only decorate a method implementation, not an overload.

Production Risk

Build will fail; resolve before shipping.

What this means

A syntax error (TS1249): A decorator can only decorate a method implementation, not an overload.. This diagnostic is emitted by the TypeScript compiler when a decorator can only decorate a method implementation, not an overload..

Why it happens
  1. 1The function overload signatures do not match the implementation
How to reproduce

TypeScript compiler reports TS1249 during type checking.

trigger — this will error
trigger — this will error
// Triggers TS1249
// A decorator can only decorate a method implementation, not an overload.

expected output

error TS1249: A decorator can only decorate a method implementation, not an overload.

Fix

Enable experimentalDecorators

WHEN Using legacy decorator syntax

Enable experimentalDecorators
// tsconfig.json
{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}

Why this works

Decorators require the 'experimentalDecorators' flag; TypeScript 5.0+ also supports the TC39 Stage 3 decorator proposal without the flag.

Sources
Official documentation ↗

TypeScript Compiler Diagnostics

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All TypeScript errors