Skip to content

Commit

Permalink
fix(ci/cd): Add types in TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Feb 27, 2024
1 parent facc7c6 commit 2069124
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default function RetractedByCountryByYear() {
queryFn: () => fetch('https://api.openalex.org/works?page=1&filter=is_retracted:true&group_by=authorships.countries').then((response) => response.json())
});

const countries = (data1?.group_by?.slice(0, 20) ?? []).map((item) => ({ name: item.key_display_name, iso2: item.key }));
const countries = (data1?.group_by?.slice(0, 20) ?? []).map((item) => ({ iso2: item.key, name: item.key_display_name }));
const results = useQueries({
queries: countries.map((country: string, index: number) => {
queries: countries.map((country: { iso2:string, name:string }, index:number) => {
return {
queryKey: ['OpenAlexRetractionsByCountryByYear', country.iso2],
queryFn: () => fetch(`https://api.openalex.org/works?page=1&filter=is_retracted:true,institutions.country_code:${country.iso2},publication_year:2000-&group_by=publication_year`).then((response) => response.json()),
Expand All @@ -25,7 +25,7 @@ export default function RetractedByCountryByYear() {
}

const years = [...Array(25).keys()].map((item) => item + 2000);
const series = results.map((result, index) => ({
const series = results.map((result: { data }, index:number) => ({
...countries[index],
data: years.map((year) => (result?.data?.group_by ?? []).find((item) => item.key === year.toString())?.count ?? 0),
}));
Expand Down

0 comments on commit 2069124

Please sign in to comment.