morphir-elm
Version:
Elm bindings for Morphir
34 lines (33 loc) • 2.39 kB
TypeScript
type CodecFunction = (input: any) => any;
type CodecList = Array<CodecFunction>;
type CodecMap = Map<string, CodecFunction>;
type Decimal = number;
export declare function buildCodecMap(entries: Array<[string, CodecFunction]>): CodecMap;
export declare function decodeUnit(input: any): [];
export declare function decodeBoolean(input: any): boolean;
export declare function decodeChar(input: any): string;
export declare function decodeDecimal(input: any): Decimal;
export declare function decodeString(input: any): string;
export declare function decodeInt(input: any): number;
export declare function decodeFloat(input: any): number;
export declare function decodeMaybe<T>(decodeElement: (any: any) => T, input: any): T | null;
export declare function decodeDict<K, V>(decodeKey: (any: any) => K, decodeValue: (any: any) => V, input: any): Map<K, V>;
export declare function decodeList<T>(decodeElement: (any: any) => T, input: any): Array<T>;
export declare function decodeRecord<recordType>(fieldDecoders: CodecMap, input: any): recordType;
export declare function decodeTuple<tupleType>(elementDecoders: CodecList, input: any): tupleType;
export declare function encodeUnit(value: []): any;
export declare function encodeBoolean(value: boolean): boolean;
export declare function encodeChar(value: string): string;
export declare function encodeDecimal(value: Decimal): Decimal;
export declare function encodeString(value: string): string;
export declare function encodeInt(value: number): number;
export declare function encodeFloat(value: number): number;
export declare function encodeMaybe<T>(encodeElement: (any: any) => T, value: T | null): T;
export declare function encodeDict<K, V>(encodeKey: (any: any) => K, encodeValue: (any: any) => V, value: Map<K, V>): Array<[K, V]>;
export declare function encodeList<T>(encodeElement: (any: any) => T, value: Array<T>): T[];
export declare function encodeRecord(fieldEncoders: CodecMap, value: object): object;
export declare function encodeTuple(elementEncoders: CodecList, value: Array<any>): Array<any>;
export declare function preprocessCustomTypeVariant(kindString: String, numArgs: number, input: any): void;
export declare function parseKindFromCustomTypeInput(input: any): string;
export declare function raiseDecodeErrorFromCustomType(customTypeName: string, kind: string): void;
export {};