@final-hill/decorator-contracts
Version:
Code Contracts for TypeScript and ECMAScript classes
7 lines (6 loc) • 545 B
text/typescript
import { Contracted } from "./Contracted.mjs";
import type { FeatureDecoratorContext } from './types.mjs';
export type DemandsPredicate<This extends Contracted> = (self: This, ...args: any[]) => boolean;
export type DemandsDecorator = <This extends Contracted, Feature = unknown>(predicate: DemandsPredicate<This>) => (value: Feature, context: FeatureDecoratorContext) => Feature | void;
export declare const demands: DemandsDecorator;
export declare function assertDemands(instance: Contracted, propertyKey: PropertyKey, ...args: any[]): void;