Can you spot the difference between the two codes below for defining a type of props?
I realized that the first one didn't throw a type error, but I can't figure out why my initial second code was incorrect. To me, it seems like it should work perfectly fine.
type Props = {
reason: {
id: number;
title: string;
description: string;
reference?:
{
title: string;
link: string;
}[];
};
};
and
type Props = {
reason: {
id: number;
title: string;
description: string;
reference?: [
{
title: string;
link: string;
}
];
};
};