export declare class ValidationFailed extends Error { constructor(kind: string, expected: any, actual: any); } /** Throw if fetched metadata differs from configured. */ export declare function validated(kind: string, value: T, expected?: T): T; /** Check if `obj` has a writable, non-method property of name `key` */ export declare function hasField(obj: T, key: keyof typeof obj): boolean; /** Set fields of first argument to values from second argument, * intelligently avoiding non-existent, read-only and method fields. * Opposite of `fallback`. */ export declare function override(obj: T, options?: Partial): T; /** Sets fields of first argument to values from second argument, * intelligently avoiding non-existent, read-only and method fields - * but only if the field is not already set. Opposite of `override`. */ export declare function fallback(obj: T, options?: Partial): T; /** Default fields start out as getters that point to the corresponding field * on the context; but if you try to set them, they turn into normal properties * with the provided value. */ export declare function defineDefault(obj: T, defaults: D, name: keyof D): void; /** A ***value object*** that allows its meaningful properties to be overridden. * For the override to work, empty properties must be defined as: * * class Named extends Overridable { * name?: Type = undefined * } * * (Otherwise Object.getOwnPropertyNames wouldn't see the property slots, * and `new Named.where({ name: 'something' })` wouldn't update `name`. * This is because of how TypeScript handles class properties; * in raw JS, they seem to be defined as undefined by default?) * * Even in when not inheriting from `Overridable`, try to follow the pattern of * ***immutable value objects*** which represent a piece of state in context * and which, instead of mutating themselves, emit changed copies of themselves * using the idioms: * this.where({ name: 'value' }) // internally * or: * new Named(oldNamed, { name: 'value' }) // externally. **/ export declare class Overridable { override(options?: object): void; /** Return copy of self with overridden properties. */ where(options?: Partial): any; } type valof = T[keyof T]; /** Override only allowed properties. */ export declare function overrideFiltered( /** Whether to fail on unexpected properties. */ strict: boolean, /** The object being overridden. */ self: object, /** The object containing the overrides. */ overrides: object, /** List of allowed properties (defaults to the defined properties on the object; * that's why many fields explicitly default to `undefined` - otherwise TypeScript * does not generate them, somewhat contrarily to native JS class behavior) */ allowed?: string[]): Record>; export {}; //# sourceMappingURL=over.d.ts.map