index.d.ts (4659B)
1 import { result } from "../../utility/result.js"; 2 import { Value } from "../../value/index.js"; 3 import { SqError } from "../SqError.js"; 4 import { SqValueContext } from "../SqValueContext.js"; 5 import { SqArray } from "./SqArray.js"; 6 import { SqCalculator } from "./SqCalculator.js"; 7 import { SqDict } from "./SqDict.js"; 8 import { SqDistribution } from "./SqDistribution/index.js"; 9 import { SqDomain } from "./SqDomain.js"; 10 import { SqInput } from "./SqInput.js"; 11 import { SqLambda } from "./SqLambda.js"; 12 import { SqPlot } from "./SqPlot.js"; 13 import { SqScale } from "./SqScale.js"; 14 import { SqTableChart } from "./SqTableChart.js"; 15 export declare function wrapValue(value: Value, context?: SqValueContext): SqArrayValue | SqBoolValue | SqDateValue | SqDistributionValue | SqLambdaValue | SqNumberValue | SqDictValue | SqStringValue | SqPlotValue | SqTableChartValue | SqCalculatorValue | SqScaleValue | SqTimeDurationValue | SqVoidValue | SqDomainValue | SqInputValue; 16 export declare abstract class SqAbstractValue<Type extends string, JSType> { 17 _value: Extract<Value, { 18 type: Type; 19 }>; 20 context?: SqValueContext | undefined; 21 abstract tag: Type; 22 constructor(_value: Extract<Value, { 23 type: Type; 24 }>, context?: SqValueContext | undefined); 25 toString(): string; 26 publicName(): "String" | "Boolean" | "Void" | "Calculator" | "Date" | "Number" | "Plot" | "Scale" | "Input" | "Domain" | "List" | "Distribution" | "Function" | "Dictionary" | "Time Duration" | "Table Chart"; 27 abstract asJS(): JSType; 28 } 29 export declare class SqArrayValue extends SqAbstractValue<"Array", unknown[]> { 30 tag: "Array"; 31 get value(): SqArray; 32 asJS(): unknown[]; 33 } 34 export declare class SqBoolValue extends SqAbstractValue<"Bool", boolean> { 35 tag: "Bool"; 36 get value(): boolean; 37 asJS(): boolean; 38 } 39 export declare class SqDateValue extends SqAbstractValue<"Date", Date> { 40 tag: "Date"; 41 get value(): Date; 42 asJS(): Date; 43 } 44 export declare class SqDistributionValue extends SqAbstractValue<"Dist", SqDistribution> { 45 tag: "Dist"; 46 get value(): SqDistribution; 47 asJS(): SqDistribution; 48 } 49 export declare class SqLambdaValue extends SqAbstractValue<"Lambda", SqLambda> { 50 tag: "Lambda"; 51 static create(value: SqLambda): SqLambdaValue; 52 get value(): SqLambda; 53 asJS(): SqLambda; 54 } 55 export declare class SqNumberValue extends SqAbstractValue<"Number", number> { 56 tag: "Number"; 57 static create(value: number): SqNumberValue; 58 get value(): number; 59 asJS(): number; 60 } 61 export declare class SqDictValue extends SqAbstractValue<"Dict", Map<string, unknown>> { 62 tag: "Dict"; 63 get value(): SqDict; 64 asJS(): Map<string, unknown>; 65 } 66 export declare class SqStringValue extends SqAbstractValue<"String", string> { 67 tag: "String"; 68 static create(value: string): SqStringValue; 69 get value(): string; 70 asJS(): string; 71 } 72 export declare class SqTimeDurationValue extends SqAbstractValue<"TimeDuration", number> { 73 tag: "TimeDuration"; 74 get value(): number; 75 asJS(): number; 76 } 77 export declare class SqPlotValue extends SqAbstractValue<"Plot", SqPlot> { 78 tag: "Plot"; 79 get value(): SqPlot; 80 asJS(): SqPlot; 81 } 82 export declare class SqTableChartValue extends SqAbstractValue<"TableChart", SqTableChart> { 83 tag: "TableChart"; 84 get value(): SqTableChart; 85 asJS(): SqTableChart; 86 } 87 export declare class SqCalculatorValue extends SqAbstractValue<"Calculator", SqCalculator> { 88 tag: "Calculator"; 89 get value(): SqCalculator; 90 asJS(): SqCalculator; 91 } 92 export declare class SqScaleValue extends SqAbstractValue<"Scale", SqScale> { 93 tag: "Scale"; 94 get value(): SqScale; 95 asJS(): SqScale; 96 } 97 export declare class SqInputValue extends SqAbstractValue<"Input", SqInput> { 98 tag: "Input"; 99 get value(): SqInput; 100 asJS(): SqInput; 101 } 102 export declare class SqVoidValue extends SqAbstractValue<"Void", null> { 103 tag: "Void"; 104 get value(): null; 105 asJS(): null; 106 } 107 export declare class SqDomainValue extends SqAbstractValue<"Domain", SqDomain> { 108 tag: "Domain"; 109 get value(): { 110 tag: "NumericRange"; 111 readonly min: number; 112 readonly max: number; 113 _value: import("../../value/domain.js").NumericRangeDomain; 114 toString(): string; 115 }; 116 asJS(): { 117 tag: "NumericRange"; 118 readonly min: number; 119 readonly max: number; 120 _value: import("../../value/domain.js").NumericRangeDomain; 121 toString(): string; 122 }; 123 } 124 export type SqValue = ReturnType<typeof wrapValue>; 125 export declare function toStringResult(result: result<SqValue, SqError>): string; 126 //# sourceMappingURL=index.d.ts.map