RecordProps
See source codeMaps a record's property types to their corresponding validators.
This utility type takes a record type with a props
object and creates
a mapping where each property key maps to a validator for that property's type.
This is used to define validation schemas for record properties.
type RecordProps<
R extends UnknownRecord & {
props: object
},
> = {
[K in keyof R['props']]: T.Validatable<R['props'][K]>
}
Example
interface MyShape
extends TLBaseShape<'custom', { width: number; color: string }> {}
// Define validators for the shape properties
const myShapeProps: RecordProps<MyShape> = {
width: T.number,
color: T.string,
}
Prev
TLUiTranslationKeyNext
RecordPropsType