API reference › @evolu/common › Type › capitalized
function capitalized<ParentType>(
parent: ValidateBrandParent<"Capitalized", ParentType>,
): Type<"Capitalized">;
Defined in: packages/common/src/Type.ts:6107
Adds capitalized text validation to an existing string Type.
Narrows the output to TypeScript's Capitalize<string> while preserving the
parent Type's constraints. Validation leaves the text unchanged. Use
capitalize to change its casing.
Example
import {
assertErr,
assertOk,
capitalized,
maxLength,
String,
} from "@evolu/common";
const Label = capitalized(maxLength(50)(String));
assertOk(Label.fromUnknown("Hello world"), "Hello world");
assertErr(Label.fromUnknown("hello world"));