UNPKG

@rxap/xml-parser

Version:

Provides a set of decorators and services for parsing and serializing XML documents into TypeScript classes. It simplifies the process of mapping XML elements and attributes to class properties, handling data validation, and serializing objects back into

21 lines (20 loc) 868 B
/** * Decorator that marks a property of a class as required. It optionally allows for a custom message to be specified. * If no message is provided, a default message indicating that the property is required will be used. * * @param message - Optional custom message to display if the property is not provided. * @returns A decorator function that takes the target object and the property key as arguments. * * ### Usage * * ```typescript * class MyComponent { * @RequiredProperty('Custom message for missing property') * importantProperty: string; * } * ``` * * In this example, `importantProperty` is marked as required. If `importantProperty` is not provided, * "Custom message for missing property" will be displayed as an error message. */ export declare function RequiredProperty(message?: string): (target: any, propertyKey: string) => void;