中文
← Errors

F_SYSTEM_UNSUPPORTED_ARRAY_TYPE

Unsupported Array option type

An option uses the generic Array constructor instead of the supported repeated-string parser.

Updated 2 weeks ago

Reproduction

The generic Array constructor does not describe the element parser:

src/app.module.ts
import { CommandMajor, FuncModule, Handler, SubOptions, run } from 'func'

@CommandMajor()
@SubOptions([{ name: 'tag', type: Array }])
class BuildCommand {
  @Handler()
  run() {}
}

@FuncModule({ commands: [BuildCommand] })
class AppModule {}

run(AppModule)

What this error means

func needs a concrete parser for every repeated value. Array alone does not identify the element type, so registration stops before parsing arguments. The error details.option and details.handler identify the declaration.

How to fix it

Use [String] for a repeated string option:

src/build.command.ts
@SubOptions([{ name: 'tag', type: [String] }])
class BuildCommand {}

For class fields, prefer @ArrayValue(), which supplies the supported parser automatically.