EN
← 错误索引

F_SYSTEM_DUPLICATE_COMMAND_TOKEN

命令 token 重复

两个已注册命令在同一父路径下使用了相同的 path token 或 alias。

更新于

复现

同一父路径下的 canonical path token 和 alias 共用命名空间:

src/commands.ts
import { Command, Handler, Module, createApp } from 'func'

@Command('build')
class BuildCommand {
  @Handler()
  run() {}
}

@Command('build')
class RebuildCommand {
  @Handler()
  run() {}
}

@Module({ commands: [BuildCommand, RebuildCommand] })
class AppModule {}

createApp(AppModule)

如何修复

确保同一父路径下的 token 唯一,或把其中一个 Command 移到不同 path:

src/commands.ts
@Command('build')
class BuildCommand {
  @Handler()
  run() {}
}

@Command('rebuild')
class RebuildCommand {
  @Handler()
  run() {}
}

@Module({ commands: [BuildCommand, RebuildCommand] })
class AppModule {}

createApp(AppModule)