API reference › @evolu/common › Type › uncapitalized

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

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

Adds uncapitalized text validation to an existing string Type.

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

Example

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

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