Fix some trivial Typescript issues

This commit is contained in:
Marshall Polaris 2022-05-24 13:44:18 -07:00
parent f2e52cfcb2
commit 4696733ec6
2 changed files with 5 additions and 4 deletions

View File

@ -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) {

View File

@ -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]]