Skip to content

Commit b794ca3

Browse files
committed
Typescript fixes
1 parent 12ec93d commit b794ca3

File tree

6 files changed

+10
-191
lines changed

6 files changed

+10
-191
lines changed

packages/skin-database/cli.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import { setHashesForSkin } from "./skinHash";
3535
import * as S3 from "./s3";
3636
import { generateDescription } from "./services/openAi";
3737
import KeyValue from "./data/KeyValue";
38-
import detectRepacks from "./tasks/detectRepacks";
3938

4039
async function withHandler(
4140
cb: (handler: DiscordEventHandler) => Promise<void>
@@ -389,10 +388,6 @@ program
389388
"Compute the order in which skins should be displayed in the museum"
390389
)
391390
.option("--foo", "Learn about missing skins")
392-
.option(
393-
"--winampskinsinfo",
394-
"Detect skins that were broken by winampskins.info injecting an ad file"
395-
)
396391
.option("--test-cloudflare", "Try to upload to cloudflare")
397392
.action(async (arg) => {
398393
const {
@@ -404,16 +399,12 @@ program
404399
configureR2Cors,
405400
computeMuseumOrder,
406401
foo,
407-
winampskinsinfo,
408402
testCloudflare,
409403
} = arg;
410404
if (testCloudflare) {
411405
const buffer = new Buffer("testing", "utf8");
412406
await S3.putTemp("hello", buffer);
413407
}
414-
if (winampskinsinfo) {
415-
await detectRepacks();
416-
}
417408
if (computeMuseumOrder) {
418409
await Skins.computeMuseumOrder();
419410
console.log("Museum order updated.");
@@ -460,10 +451,12 @@ program
460451
}
461452
if (foo) {
462453
const ctx = new UserContext();
463-
const missingModernSkins = await KeyValue.get("missingModernSkins");
454+
const missingModernSkins = await KeyValue.get<string[]>(
455+
"missingModernSkins"
456+
);
464457
const missingModernSkinsSet = new Set(missingModernSkins);
465458
const skins = {};
466-
for (const md5 of missingModernSkins) {
459+
for (const md5 of missingModernSkins!) {
467460
const skin = await SkinModel.fromMd5(ctx, md5);
468461
if (skin == null) {
469462
continue;
@@ -489,7 +482,7 @@ program
489482
.select();
490483
console.log(`Found ${skinRows.length} skins to update`);
491484
const missingModernSkins = new Set(
492-
await KeyValue.get("missingModernSkins")
485+
await KeyValue.get<string[]>("missingModernSkins")
493486
);
494487
const skins = skinRows.map((row) => new SkinModel(ctx, row));
495488
for (const skin of skins) {

packages/skin-database/data/SkinModel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export default class SkinModel {
249249
const response = await fetch(this.getSkinUrl());
250250
if (!response.ok) {
251251
const missingModernSkins =
252-
(await KeyValue.get("missingModernSkins")) ?? [];
252+
(await KeyValue.get<string[]>("missingModernSkins")) ?? [];
253253
const missingModernSkinsSet = new Set(missingModernSkins);
254254
missingModernSkinsSet.add(this.getMd5());
255255
await KeyValue.set(
@@ -410,6 +410,7 @@ export default class SkinModel {
410410

411411
getZip = mem(async (): Promise<JSZip> => {
412412
const buffer = await this.getBuffer();
413+
// @ts-ignore TODO: Is this typing correct?
413414
return JSZip.loadAsync(buffer);
414415
});
415416

packages/skin-database/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"sync": "ts-node --transpile-only ./tasks/syncWithArchive.ts",
5656
"migrate": "knex migrate:latest",
5757
"grats": "grats",
58+
"typecheck": "tsc --noEmit",
5859
"dev:next": "next dev",
5960
"build:next": "next build",
6061
"start:next": "next start",

packages/skin-database/tasks/DeleteSkin.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/skin-database/tasks/detectRepacks.ts

Lines changed: 0 additions & 168 deletions
This file was deleted.

packages/skin-database/tasks/tweetMilestones.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ export async function followerCount(handler: DiscordEventHandler) {
103103
const user = response.data;
104104

105105
const followerCount = user.followers_count;
106-
const current: { count: number } = await KeyValue.get(FOLLOW_COUNT_KEY);
107-
const currentNumber = current.count;
106+
const current = await KeyValue.get<{ count: number }>(FOLLOW_COUNT_KEY);
107+
const currentNumber = current!.count;
108108

109109
const nextMilestone = currentNumber + FOLLOW_COUNT_BRACKET_SIZE;
110110

0 commit comments

Comments
 (0)