typescripttypes

TypeScript, unexpected any, specify a different type


I am failing to understand, what is the issue here.

type TypeSocialLinks = {
    [key: string]: {
        [key: string]: any | undefined;
    };
};

export const socialLinks: TypeSocialLinks = {
    facebook: {
        url: "//www.facebook.com/xxxxxxxx",
        icon: <FontAwesomeIcon icon={faFacebookF} />,
    },
    instagram: {
        url: "//www.instagram.com/xxxxxxxx",
        icon: <FontAwesomeIcon icon={faInstagram} />,
    },
};

Issue


Solution

  • That message is most likely coming from ESLint, which has most likely been configured with no-explicit-any enabled. If you want to allow explicit anys, then disable that rule.