( path: SchemaPath<TValue>, logic: LogicFn<TValue, boolean>, schema: NoInfer<SchemaOrSchemaFn<TValue>>, )
| 351 | * @publicApi 22.0 |
| 352 | */ |
| 353 | export function applyWhen<TValue>( |
| 354 | path: SchemaPath<TValue>, |
| 355 | logic: LogicFn<TValue, boolean>, |
| 356 | schema: NoInfer<SchemaOrSchemaFn<TValue>>, |
| 357 | ): void { |
| 358 | assertPathIsCurrent(path); |
| 359 | |
| 360 | const pathNode = FieldPathNode.unwrapFieldPath(path); |
| 361 | pathNode.mergeIn(SchemaImpl.create(schema), {fn: logic, path}); |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * Conditionally applies a predefined schema to a given `FieldPath`. |
no test coverage detected