I have the following type.
type Team = 'liverpool' | 'manUtd' | 'arsenal' | null;
I then have the following object.
const teams: Record<Team, JSX.Element> = {
liverpool: <Liverpool />,
manUtd: <ManU />,
arsenal: <Arsenal />,
};
If I use teams as the first part of the Record I see the following error:
Type 'Team' does not satisfy the constraint 'string | number | symbol'.
Type 'null' is not assignable to type 'string | number | symbol'.ts(2344)
If I use Record<string, JSX.Element> it works fine.
nullcannot be used as a key. Why do you neednullin your type definition?