API reference › @evolu/common › Type › uppercased

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

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

Adds uppercased text validation to an existing string Type.

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

Example

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

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