That’s not how you type a const function. What you wrote translates to “I want a const variable named getRelated with type Items” and then follow to assign it a function as value. That’s what the exception tells you.

What you probably want is

const getRelated = (items: Items, id: number): Items => {

Playground link

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top