Skip to content

PipeMethods

@tsed/schema

Usage

typescript
import { PipeMethods } from "@tsed/schema";

See /packages/specs/schema/src/domain/JsonParameterStore.ts.

Overview

ts
interface PipeMethods<T = any, R = any> {
    transform(value: T, metadata: JsonParameterStore): R;
}

Description

Interface for pipe classes that transform parameter values.

Pipes are called by the framework to transform or validate parameter values before they reach the method handler.

Usage

typescript
class ParseIntPipe implements PipeMethods<string, number> {
  transform(value: string, metadata: JsonParameterStore): number {
    return parseInt(value, 10);
  }
}

transform

ts
transform(value: T, metadata: JsonParameterStore): R;

Released under the MIT License.