中文
← Errors

F_SYSTEM_INVALID_METHOD_DECORATOR_TARGET

Invalid method decorator target

A method decorator is attached to an unsupported target or handler kind.

Updated

Reproduction

Method decorators need an instance so func can inject dependencies and invoke the method:

src/build.command.ts
import { Handler } from 'func'

class BuildCommand {
  @Handler()
  static run() {}
}

How to fix it

Use an instance method:

src/build.command.ts
class BuildCommand {
  @Handler()
  run() {}
}

This error also occurs when @Deprecated() decorates a default or path handler. @Deprecated() supports @Handler({ flag }) action options; use the deprecated parameter on @Command to deprecate a default or path-based command entry point.