/** * @file * * Mock of Obsidian's `PrimitiveValue`, the base of Bases values that wrap a single primitive. */ import type { PrimitiveValue as PrimitiveValueOriginal } from 'obsidian'; import type { Value } from './Value.cjs'; import { NotNullValue } from './NotNullValue.cjs'; /** * Mock of Obsidian's `PrimitiveValue`, the abstract base type for Bases values wrapping a single primitive. * * @typeParam T - The type of the wrapped primitive. */ export declare abstract class PrimitiveValue extends NotNullValue { /** * The wrapped primitive. Obsidian's own name for it, which is why this carries no `__` suffix (L4). */ data: T; /** * Creates a value wrapping `value`. * * @param value - The primitive to wrap. */ constructor(value: T); /** * Mock-only: views a value typed as Obsidian's `PrimitiveValue` as this mock. * * @typeParam T - The type of the wrapped primitive. * @param value - The value typed as the original `PrimitiveValue`. * @returns The same object, typed as the mock. */ static fromOriginalType3__(value: PrimitiveValueOriginal): PrimitiveValue; /** * Mock-only: views this mock as Obsidian's `PrimitiveValue` type. * * @returns The same object, typed as the original `PrimitiveValue`. */ asOriginalType3__(): PrimitiveValueOriginal; /** * Mock-only construction hook, called at the end of the constructor; a no-op meant for * `vi.spyOn(PrimitiveValue.prototype, 'constructor3__')`. * * @param _value - The primitive the value was created with. */ constructor3__(_value: T): void; /** * Compares this value with another of the same type, as Obsidian does: by strict equality of the wrapped * primitives. * * @param other - The value to compare with. * @returns Whether the two wrapped primitives are strictly equal. */ equals(other: this): boolean; /** * Reports whether the value counts as true in a condition, by JavaScript truthiness of the wrapped primitive. * * @returns Whether the wrapped primitive is truthy. */ isTruthy(): boolean; /** * Loosely compares this value with a value of any type, as Obsidian does: any other primitive value whose * wrapped primitive is LOOSELY equal to this one. The `==` is Obsidian's own and is the whole point of the * override - it is what makes `BooleanValue(true)` loosely equal `NumberValue(1)` and `StringValue('1')`. * * @param other - The value to compare with. * @returns Whether `other` is a primitive value wrapping a loosely equal primitive. */ looseEquals(other: Value): boolean; /** * Converts the value to its display string. * * @returns The wrapped primitive converted with `String`. */ toString(): string; }