“Type ‘{ test: string; }’ cannot be used as an index type” in my react-native tsx application

I’m new to react-native, but I’m trying to send the index of a list to another screen.

saved.tsx

onPress={() => router.push({
    pathname: "/lists/list",
    params: {
        test: list.id,
        },
        })}


I’m receiving the list.id in list.tsx, so it’s being sent properly. However, I can’t use it as an index in the following function in my list.tsx due to the error mentioned in the title

const Page = (props: Props) => {
    const { query } = useLocalSearchParams<{ query: string }>();
    <View>
        {restaurantLists[{ query }].contents.map((list) => {
        return (
            <TouchableOpacity>
                <List.Item
                    title={list.restaurantName}
                    description="Item description"
                    left={props => <List.Icon {...props} icon="equal" />}
                />
           </TouchableOpacity>
        );
        })}
    </View>
}

Example of database

export const restaurantLists = [
    {
        id: "1",
        listName: "Italian",
        contents: [
            {
                key: "1",
                restaurantName: "Olive Garden",
            },
            {
                key: "2",
                restaurantName: "Tabellas",
            },
            {
                key: "3",
                restaurantName: "Mauricios",
            },
            {
                key: "4",
                restaurantName: "dunno",
            },
        ]
    },

I’m expecting to be able to use the query being sent in params as an index, but I receive the “Type ‘{ test: string; }’ cannot be used as an index type” error