Open
Description
Most easily explained with an example, if I have a definition in my schema as follows:
"color": {
"$id": "#color",
"type": "string",
"enum": [
"blue",
"red",
"yellow"
]
}
Currently this gets converted into a string union type directly ie. export type Color = "blue" | "red" | "yellow";
I'd like the option to convert these via a const assertion, emitting instead the following:
export const COLORS = ["blue", "red", "yellow"] as const;
export type Color = typeof COLORS[number];
Reason for this probably goes without saying - this would then allow the items to be accessed as values in code.
Could I get your thoughts on inclusion of this, would you accept a PR?