| 1 |
import type { DescEnum, DescFile } from "../descriptors.js"; |
| 2 |
import type { GenEnum } from "./types.js"; |
| 3 |
import type { JsonValue } from "../json-value.js"; |
| 4 |
/** |
| 5 |
* Hydrate an enum descriptor. |
| 6 |
* |
| 7 |
* @private |
| 8 |
*/ |
| 9 |
export declare function enumDesc<Shape extends number, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenEnum<Shape, JsonType>; |
| 10 |
/** |
| 11 |
* Construct a TypeScript enum object at runtime from a descriptor. |
| 12 |
* |
| 13 |
* The returned object is identical to a transpiled TS enum and includes the |
| 14 |
* reverse mapping, see https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings |
| 15 |
*/ |
| 16 |
export declare function tsEnum(desc: DescEnum): { |
| 17 |
[key: number]: string; |
| 18 |
[k: string]: string | number; |
| 19 |
}; |
| 20 |
/** |
| 21 |
* Construct an object enum at runtime from a descriptor. |
| 22 |
* |
| 23 |
* The returned object is a record of enum value name to integer value. It's |
| 24 |
* a subset of transpiled TS enums - it does not include the reverse mapping, |
| 25 |
* and only supports lookup by value name. |
| 26 |
*/ |
| 27 |
export declare function objEnum(desc: DescEnum): { |
| 28 |
[key: string]: number; |
| 29 |
}; |