From 4696733ec6fa0f40601fe36136682ffadcd9c809 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Tue, 24 May 2022 13:44:18 -0700 Subject: [PATCH] Fix some trivial Typescript issues --- common/envs/constants.ts | 6 +++--- common/util/random.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/envs/constants.ts b/common/envs/constants.ts index db82f014..c03c44bc 100644 --- a/common/envs/constants.ts +++ b/common/envs/constants.ts @@ -5,13 +5,13 @@ import { THEOREMONE_CONFIG } from './theoremone' export const ENV = process.env.NEXT_PUBLIC_FIREBASE_ENV ?? 'PROD' -const CONFIGS = { +const CONFIGS: { [env: string]: EnvConfig } = { PROD: PROD_CONFIG, DEV: DEV_CONFIG, THEOREMONE: THEOREMONE_CONFIG, } -// @ts-ignore -export const ENV_CONFIG: EnvConfig = CONFIGS[ENV] + +export const ENV_CONFIG = CONFIGS[ENV] export function isWhitelisted(email?: string) { if (!ENV_CONFIG.whitelistEmail) { diff --git a/common/util/random.ts b/common/util/random.ts index 5a475893..c26b361b 100644 --- a/common/util/random.ts +++ b/common/util/random.ts @@ -5,6 +5,7 @@ export const randomString = (length = 12) => export function genHash(str: string) { // xmur3 + let h: number for (let i = 0, h = 1779033703 ^ str.length; i < str.length; i++) { h = Math.imul(h ^ str.charCodeAt(i), 3432918353) h = (h << 13) | (h >>> 19) @@ -39,7 +40,7 @@ export function createRNG(seed: string) { } } -export const shuffle = (array: any[], rand: () => number) => { +export const shuffle = (array: unknown[], rand: () => number) => { for (let i = 0; i < array.length; i++) { const swapIndex = Math.floor(rand() * (array.length - i)) ;[array[i], array[swapIndex]] = [array[swapIndex], array[i]]