Hyperlinkv0.8.0-beta.28

SchemaTransformation

SchemaTransformation.isTransformationfunctioneffect/SchemaTransformation.ts:197
(u: unknown): u is Transformation<any, any, unknown, unknown>

Returns true if u is a Transformation instance.

When to use

Use to check whether a value is already a schema transformation before wrapping it.

Details

  • Pure predicate, no side effects.
  • Acts as a TypeScript type guard.

Example (Checking a value)

import { SchemaTransformation } from "effect"

SchemaTransformation.isTransformation(SchemaTransformation.trim())
// true

SchemaTransformation.isTransformation({ decode: null, encode: null })
// false
export function isTransformation(u: unknown): u is Transformation<any, any, unknown, unknown> {
  return Predicate.hasProperty(u, TypeId)
}
Referenced by 1 symbols