@vaadin/hilla-models
Version:
Generative form models for Hilla
12 lines (11 loc) • 810 B
TypeScript
import type { EmptyObject } from 'type-fest';
import { type NonAttributedConstraint, $name, type AnyObject, Model, type Value } from './Model.js';
export declare class ConstraintBuilder<V = unknown, const N extends string = string, A extends AnyObject = EmptyObject> {
#private;
protected [$name]: N | undefined;
constructor();
model<const M extends Model<V>>(supportedModel: M): ConstraintBuilder<Value<M>, N, A>;
name<const NN extends N>(name: NN): ConstraintBuilder<V, N & NN, A>;
attribute<AN extends string, AV>(name: AN, model: Model<AV>): ConstraintBuilder<V, N, (A extends EmptyObject ? AnyObject : A) & Readonly<undefined extends AV ? Partial<Record<AN, AV>> : Record<AN, AV>>>;
build(this: string extends N ? never : this): NonAttributedConstraint<V | undefined, N, A>;
}