mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-20 22:28:30 +01:00
* chore(ci): Nx for github validations * chore: tune config * chore: eslint scripts faster and unified settings * chore: check formatting using nx * chore: read-only NX token
@trezor/validation
This package extends yup validation library with custom methods, messages and types. Whenever yup is used in Suite, it should be imported from here rather than directly from yup. Using ValidationSchema enables type check on the schema object.
Usage
import { ValidationSchema, yup } from '@trezor/validation';
// providing a type for the schema object for type safety
type MySchema = {
myField: string;
};
const mySchema =
yup.object <
ValidationSchema<MySchema>({
myField: yup
.string() // standard yup validation
.isAscii(), // custom validation including a custom message
});