中文
← Errors

F_SYSTEM_MISSING_PARAM_TYPES

Missing parameter type metadata

The runtime cannot infer the Provider token requested by a constructor or Handler parameter.

Updated

Reproduction

A constructor or Handler has parameters, but the compiled output contains neither design-time parameter metadata nor an explicit @Inject() token:

src/app.module.ts
import { Command, Handler, Injectable, Module, createApp } from 'func'

@Injectable()
class ProjectService {}

@Command('inspect')
class InspectCommand {
  constructor(private project: ProjectService) {}

  @Handler()
  run() {}
}

@Module({
  commands: [InspectCommand],
  providers: [ProjectService],
})
class AppModule {}

createApp(AppModule)

What this error means

func knows the parameter position but cannot determine which token to request from the DI container. details.target identifies the class or method, and details.index gives the parameter position.

How to fix it

For class-type injection, enable decorators and parameter metadata in the TypeScript configuration used by the actual build:

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

Use an explicit token for interfaces, type-only dependencies, or parameters that should not depend on reflection metadata:

src/commands/inspect.command.ts
import { Inject, createToken } from 'func'

interface Project {
  name: string
}

const PROJECT = createToken<Project>('PROJECT')

class InspectCommand {
  constructor(@Inject(PROJECT) private project: Project) {}
}

Whichever approach you use, register the corresponding Provider in the current Module and ensure imported Providers are exported explicitly.