I want to construct type {name:string,value:string} from another type Todo.
Below code throws error: Property '0' does not exist on type 'Pick<Todo, "items">'.
type Todo = {
title: string;
items:Array<{name:string,value:string}>;
description: string;
completed: boolean;
}
type TodoItems = Pick<Todo, "items">[0]; //ERROR: Property '0' does not exist on type 'Pick<Todo, "items">'.
const todo: TodoItems = {
name: "Clean room",
value: "yes",
};
Note:
Todocomes from atsmodule so it's not editable.
What approach could I follow to extract {name:string,value:string} from Todo?