@codama/renderers-js
Version:
JavaScript renderer compatible with the Solana Kit library
20 lines • 872 B
TypeScript
/**
* Renders the body of a numeric TypeScript enum declaration.
*
* When `erasableSyntax` is enabled, the object mirrors exactly what a numeric `enum`
* compiles to: the reverse mapping from value to variant name followed by the forward
* entries. This matters because `@solana/codecs` derives an enum's keys and values by
* inspecting that runtime shape.
*
* @param variantNames - The variant names, in declaration order.
* @param erasableSyntax - Whether to render the runtime object used for erasable enums.
* @returns The object body, without the surrounding braces.
*
* @example
* ```ts
* getEnumBody(['Uninitialized', 'Asset'], true);
* // "0: 'Uninitialized', 1: 'Asset', Uninitialized: 0, Asset: 1"
* ```
*/
export declare function getEnumBody(variantNames: string[], erasableSyntax: boolean): string;
//# sourceMappingURL=erasableSyntax.d.ts.map