API reference › @evolu/common › Type › lowercased

function lowercased<
  ParentType extends AnyType & {
    Output: string;
  },
>(parent: ValidateBrandParent<"Lowercased", ParentType>): Type<"Lowercased">;

Defined in: packages/common/src/Type.ts:7451

Adds lowercased text validation to an existing string Type.

Narrows the output to TypeScript's Lowercase<string> while preserving the parent Type's constraints. Validation leaves the text unchanged. Use lowercase to change its casing.

Example

import {
  assertErr,
  assertOk,
  lowercased,
  maxLength,
  String,
} from "@evolu/common";

const Label = lowercased(maxLength(50)(String));
assertOk(Label.fromUnknown("hello world"), "hello world");
assertErr(Label.fromUnknown("Hello WORLD"));