this repo has no description

More explicit type defs

authored by ari.express and committed by astrra.space cb4189ee 7d850f0a

verified
+5 -11
+5 -11
src/lib/pdsfetch.ts
··· 111 111 }), 112 112 }); 113 113 114 - const getDidsFromPDS = async () => { 114 + const getDidsFromPDS = async () : Promise<At.Did[]> => { 115 115 const { data } = await rpc.get("com.atproto.sync.listRepos", { 116 116 params: {}, 117 117 }); 118 - return data.repos.map((repo: any) => (repo.did)); 118 + return data.repos.map((repo: any) => (repo.did)) as At.Did[]; 119 119 }; 120 - const getAccountMetadata = async (did: `did:${string}:${string}`) => { 120 + const getAccountMetadata = async (did: `did:${string}:${string}`) : Promise<AccountMetadata> => { 121 121 // gonna assume self exists in the app.bsky.actor.profile 122 122 try { 123 123 const { data } = await rpc.get("com.atproto.repo.getRecord", { ··· 146 146 did: "error", 147 147 displayName: "", 148 148 avatarCid: null, 149 + handle: "error", 149 150 }; 150 151 } 151 152 }; 152 153 153 - const getAllMetadataFromPds = async () => { 154 + const getAllMetadataFromPds = async () : Promise<AccountMetadata[]> => { 154 155 const dids = await getDidsFromPDS(); 155 156 const metadata = await Promise.all( 156 157 dids.map(async (repo: `did:${string}:${string}`) => { ··· 238 239 ); 239 240 posts.sort((a, b) => b.timestamp - a.timestamp); 240 241 return posts; 241 - }; 242 - 243 - const testApiCall = async () => { 244 - const { data } = await rpc.get("com.atproto.sync.listRepos", { 245 - params: {}, 246 - }); 247 - console.log(data); 248 242 }; 249 243 export { fetchAllPosts, getAllMetadataFromPds, Post }; 250 244 export type { AccountMetadata };