I have this helper I use to make type guards.
const typeGuard = buildTypeGuard<{ name: string, friends: IFriend[] }>({
name: isString,
friends: [isFriend],
})
It takes a type and an argument. The argument is a "type guide" which is instructions on how to build the typeguard. The type determines the shape of the type guide. So if you pass in a type with { friends: IFriend[] }
you must pass in a type guide that includes { friends: [isFriend] }
.