( path: SchemaPath<TValue>, logic: LogicFn<TValue, boolean>, schema: NoInfer<SchemaOrSchemaFn<TValue>>, )
| 336 | * @publicApi 22.0 |
| 337 | */ |
| 338 | export function applyWhen<TValue>( |
| 339 | path: SchemaPath<TValue>, |
| 340 | logic: LogicFn<TValue, boolean>, |
| 341 | schema: NoInfer<SchemaOrSchemaFn<TValue>>, |
| 342 | ): void { |
| 343 | assertPathIsCurrent(path); |
| 344 | |
| 345 | const pathNode = FieldPathNode.unwrapFieldPath(path); |
| 346 | pathNode.mergeIn(SchemaImpl.create(schema), {fn: logic, path}); |
| 347 | } |
| 348 | |
| 349 | /** |
| 350 | * Conditionally applies a predefined schema to a given `FieldPath`. |
no test coverage detected