type Item = {
id: string;
value: string;
};
const items: Readonly<Item>[] = [
{ id: 'id1', value: 'TODO1' },
{ id: 'id2', value: 'TODO2' },
{ id: 'id3', value: 'TODO3' },
];
I want to get type 'TODO1' | 'TODO2' | 'TODO3';
const items = [...] as const;
type Type = typeof items[number]['value'];
I could get a type by const assertion. But this case, I lost my items type..
: Readonly<Item>[]and useas const