I'm trying to call an url gathered from the api request but im getting the error "Element implicitly has an 'any' type because index expression is not of type 'number'."
interface Repo {
id: number;
name: string;
description: string;
html_url: string;
fork: string;
languages_url: string;
}
interface Data {
message: string;
}
interface LanguageData {
[key: string]: number;
}
export default function Projects() {
async function repoFetch() {
let r = await axios.get("../repos");
return Object.values<Repo>(r.data);
}
const {
data: repo,
isError,
error,
} = useQuery("Repos", repoFetch, {
refetchOnWindowFocus: false,
});
async function languageFetch() {
if (!repo) {
return null;
}
let res = await axios.get<LanguageData>(repo["languages_url"]); ///error here
return res.data
}
const { data: language } = useQuery("Languages", languageFetch, {
refetchOnWindowFocus: false,
enabled: !!repo,
});