ArgumentMetadata is the metadata object passed as the second parameter to PipeTransform.transform(). It describes the currently processed method argument with three properties:

  • type: 'body' | 'query' | 'param' | 'custom' — indicates the parameter decorator used
  • metatype: The runtime type of the argument (e.g., String). Is undefined if no type is declared or JavaScript is used. TypeScript interfaces produce Object because they’re erased during transpilation.
  • data: The string passed to the decorator (e.g., @Body('name') gives 'name'). Is undefined if the decorator has empty parentheses.

The metatype field is critical for Pipes validation — it explains why DTO Classes vs Interfaces recommends classes over interfaces.