fix type errors in SponsorsService.ts

This commit is contained in:
Hazelnoot 2025-04-30 11:13:38 -04:00
parent e7aeb4cdb9
commit 4ea1b6aa4d

View file

@ -63,7 +63,7 @@ export class SponsorsService implements OnApplicationShutdown {
} }
try { try {
const backers: Sponsor[] = await fetch(`${this.meta.donationUrl}/members/users.json`).then((response) => response.json()); const backers = await fetch(`${this.meta.donationUrl}/members/users.json`).then((response) => response.json() as Promise<Sponsor[]>);
// Merge both together into one array and make sure it only has Active subscriptions // Merge both together into one array and make sure it only has Active subscriptions
const allSponsors = [...backers].filter(sponsor => sponsor.isActive && sponsor.role === 'BACKER' && sponsor.tier); const allSponsors = [...backers].filter(sponsor => sponsor.isActive && sponsor.role === 'BACKER' && sponsor.tier);
@ -78,8 +78,8 @@ export class SponsorsService implements OnApplicationShutdown {
@bindThis @bindThis
private async fetchSharkeySponsors(): Promise<Sponsor[]> { private async fetchSharkeySponsors(): Promise<Sponsor[]> {
try { try {
const backers: Sponsor[] = await fetch('https://opencollective.com/sharkey/tiers/backer/all.json').then((response) => response.json()); const backers = await fetch('https://opencollective.com/sharkey/tiers/backer/all.json').then((response) => response.json() as Promise<Sponsor[]>);
const sponsorsOC: Sponsor[] = await fetch('https://opencollective.com/sharkey/tiers/sponsor/all.json').then((response) => response.json()); const sponsorsOC = await fetch('https://opencollective.com/sharkey/tiers/sponsor/all.json').then((response) => response.json() as Promise<Sponsor[]>);
// Merge both together into one array and make sure it only has Active subscriptions // Merge both together into one array and make sure it only has Active subscriptions
const allSponsors = [...sponsorsOC, ...backers].filter(sponsor => sponsor.isActive); const allSponsors = [...sponsorsOC, ...backers].filter(sponsor => sponsor.isActive);