mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(forms): add validateStandardSchema to public api (#63616)
Add `validateStandardSchema` which was accidentally omitted from the public api. PR Close #63616
This commit is contained in:
parent
1233f7319d
commit
00a1806eaa
3 changed files with 20 additions and 9 deletions
|
|
@ -226,6 +226,11 @@ export interface HttpValidatorOptions<TValue, TResult, TPathKind extends PathKin
|
|||
readonly request: ((ctx: FieldContext<TValue, TPathKind>) => string | undefined) | ((ctx: FieldContext<TValue, TPathKind>) => HttpResourceRequest | undefined);
|
||||
}
|
||||
|
||||
// @public
|
||||
export type IgnoreUnknownProperties<T> = T extends Record<PropertyKey, unknown> ? {
|
||||
[K in keyof T as RemoveStringIndexUnknownKey<K, T[K]>]: IgnoreUnknownProperties<T[K]>;
|
||||
} : T;
|
||||
|
||||
// @public
|
||||
export interface ItemFieldContext<TValue> extends ChildFieldContext<TValue> {
|
||||
readonly index: Signal<number>;
|
||||
|
|
@ -411,6 +416,9 @@ export type ReadonlyArrayLike<T> = Pick<ReadonlyArray<T>, number | 'length' | ty
|
|||
// @public
|
||||
export function reducedProperty<TAcc, TItem>(reduce: (acc: TAcc, item: TItem) => TAcc, getInitial: () => TAcc): AggregateProperty<TAcc, TItem>;
|
||||
|
||||
// @public
|
||||
export type RemoveStringIndexUnknownKey<K, V> = string extends K ? unknown extends V ? never : K : K;
|
||||
|
||||
// @public
|
||||
export const REQUIRED: AggregateProperty<boolean, boolean>;
|
||||
|
||||
|
|
@ -496,6 +504,9 @@ export function validateAsync<TValue, TParams, TResult, TPathKind extends PathKi
|
|||
// @public
|
||||
export function validateHttp<TValue, TResult = unknown, TPathKind extends PathKind = PathKind.Root>(path: FieldPath<TValue, TPathKind>, opts: HttpValidatorOptions<TValue, TResult, TPathKind>): void;
|
||||
|
||||
// @public
|
||||
export function validateStandardSchema<TSchema, TValue extends IgnoreUnknownProperties<TSchema>>(path: FieldPath<TValue>, schema: StandardSchemaV1<TSchema>): void;
|
||||
|
||||
// @public
|
||||
export function validateTree<TValue, TPathKind extends PathKind = PathKind.Root>(path: FieldPath<TValue, TPathKind>, logic: NoInfer<TreeValidator<TValue, TPathKind>>): void;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@
|
|||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
export {email} from './email';
|
||||
export {max} from './max';
|
||||
export {maxLength} from './max_length';
|
||||
export {min} from './min';
|
||||
export {minLength} from './min_length';
|
||||
export {pattern} from './pattern';
|
||||
export {required} from './required';
|
||||
export * from './email';
|
||||
export * from './max';
|
||||
export * from './max_length';
|
||||
export * from './min';
|
||||
export * from './min_length';
|
||||
export * from './pattern';
|
||||
export * from './required';
|
||||
export * from './standard_schema';
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@
|
|||
import {ApplicationRef, Injector, signal} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import * as z from 'zod';
|
||||
import {form, schema} from '../../../../public_api';
|
||||
import {validateStandardSchema} from '../../../../src/api/validators/standard_schema';
|
||||
import {form, schema, validateStandardSchema} from '../../../../public_api';
|
||||
|
||||
interface Flight {
|
||||
id: number;
|
||||
|
|
|
|||
Loading…
Reference in a new issue