File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
22let data;
3+ interface Repo {
4+ name: string ;
5+ html_url: string ;
6+ stargazers_count: number ;
7+ updated_at: string ;
8+ private: boolean ;
9+ fork: boolean ;
10+ archived: boolean ;
11+ }
312
413const backupData = [
514 {
@@ -36,7 +45,7 @@ async function load() {
3645 },
3746 });
3847 if (res .status === 200 ) {
39- const json = await res .json ();
48+ const json = ( await res .json ()) as Repo [] ;
4049 const repos = json .map ((repo ) => {
4150 return repo .private === false &&
4251 repo .fork === false &&
@@ -50,9 +59,9 @@ async function load() {
5059 : {};
5160 });
5261
53- data = repos
54- .filter ((repo ) => Object .keys (repo ).length !== 0 )
55- .sort ((a , b ) => b .stargazers_count - a .stargazers_count );
62+ data = (
63+ repos .filter ((repo ) => Object .keys (repo ).length !== 0 ) as Repo []
64+ ) .sort ((a , b ) => b .stargazers_count - a .stargazers_count );
5665 } else {
5766 data = backupData ;
5867 }
You can’t perform that action at this time.
0 commit comments