P.shape(somePattern) lets you call methods like .optional(), .and, .or and .select() On structural patterns, like objects and arrays.
P.shape(somePattern)
.optional()
.and
.or
.select()
Read the documentation for P.shape on GitHub
P.shape
.with( { state: P.shape({ status: "success" }).optional().select() }, (state) => 'match the success state, or undefined.' ) Copy
.with( { state: P.shape({ status: "success" }).optional().select() }, (state) => 'match the success state, or undefined.' )
P.shape(somePattern)
lets you call methods like.optional()
,.and
,.or
and.select()
On structural patterns, like objects and arrays.Read the documentation for
P.shape
on GitHub