This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object().shape( | |
{ | |
lunchStyles: array().min(1, 'お昼ごはんの選択は必須です。'), | |
salads: array().when( | |
['lunchStyles', 'soups'], | |
{ | |
is: ( | |
lunchStyles: string[], | |
soups: string[] | |
) => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const validateLunchBoxStyle = function (this: any) { | |
const { | |
lunchStyles, | |
soups, | |
salads | |
} = this.parent | |
return !( | |
lunchStyles.includes('lunchBox') && | |
soups.length === 0 && | |
salads.length === 0 |