UNPKG

simc-ast-builder

Version:

Parser and AST generator for SimulationCraft files

98 lines 2.74 kB
/** * Field utilities for the simc-ast-builder * Provides a type-safe, immutable Field class for representing field definitions */ /** * Expression type for fields */ export type ExpressionType = "boolean" | "numeric" | "neutral"; /** * Options for creating a Field */ export interface FieldOptions { /** * Display name for the field (defaults to name if not provided) */ displayName?: string; /** * Negated name for the field (defaults to name if not provided) * Used for boolean fields when negated (e.g., "up" -> "down") */ negatedName?: string; /** * Type of the field (defaults to "neutral" if not provided) */ type?: ExpressionType; } /** * Immutable Field class for representing field definitions */ export declare class Field { /** * Display name for the field */ readonly displayName: string; /** * Name of the field */ readonly name: string; /** * Negated name for the field */ readonly negatedName: string; /** * Type of the field */ readonly type: ExpressionType; /** * Create a new Field * @param name Name of the field * @param options Options for the field */ constructor(name: string, options?: FieldOptions); /** * Check if the field is a boolean field * @returns True if the field is a boolean field */ isBoolean(): boolean; /** * Check if the field is a neutral field * @returns True if the field is a neutral field */ isNeutral(): boolean; /** * Check if the field is a numeric field * @returns True if the field is a numeric field */ isNumeric(): boolean; /** * Convert the Field to a JSON object * @returns A JSON representation of the Field */ toJSON(): object; /** * Create a new Field with a different display name * @param displayName New display name for the field * @returns A new Field with the updated display name */ withDisplayName(displayName: string): Field; /** * Create a new Field with a different name * @param name New name for the field * @returns A new Field with the updated name */ withName(name: string): Field; /** * Create a new Field with a different negated name * @param negatedName New negated name for the field * @returns A new Field with the updated negated name */ withNegatedName(negatedName: string): Field; /** * Create a new Field with a different type * @param type New type for the field * @returns A new Field with the updated type */ withType(type: ExpressionType): Field; } //# sourceMappingURL=Field.d.ts.map