From 397d90c6b770a55c595724b6309482b73f0a2d8a Mon Sep 17 00:00:00 2001 From: Forrest Wolf Date: Thu, 2 Jun 2022 19:40:41 -0500 Subject: [PATCH] Replace some more uses of `any` with more specific types (#389) * Give confirmation button icon a type * Give setBids a type * Make StripeSession type more specific * Give MenuButton buttonContent a type --- functions/src/stripe.ts | 8 +++++++- web/components/confirmation-button.tsx | 2 +- web/components/nav/menu.tsx | 2 +- web/pages/simulator.tsx | 6 ++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/functions/src/stripe.ts b/functions/src/stripe.ts index d32010a6..ac3e2a19 100644 --- a/functions/src/stripe.ts +++ b/functions/src/stripe.ts @@ -5,7 +5,13 @@ import Stripe from 'stripe' import { getPrivateUser, getUser, isProd, payUser } from './utils' import { sendThankYouEmail } from './emails' -export type StripeSession = Stripe.Event.Data.Object & { id: any, metadata: any} +export type StripeSession = Stripe.Event.Data.Object & { + id: string + metadata: { + userId: string + manticDollarQuantity: string + } +} export type StripeTransaction = { userId: string diff --git a/web/components/confirmation-button.tsx b/web/components/confirmation-button.tsx index e07b6dab..e895467a 100644 --- a/web/components/confirmation-button.tsx +++ b/web/components/confirmation-button.tsx @@ -8,7 +8,7 @@ export function ConfirmationButton(props: { id: string openModalBtn: { label: string - icon?: any + icon?: JSX.Element className?: string } cancelBtn?: { diff --git a/web/components/nav/menu.tsx b/web/components/nav/menu.tsx index 9d348fab..24fb35a4 100644 --- a/web/components/nav/menu.tsx +++ b/web/components/nav/menu.tsx @@ -3,7 +3,7 @@ import { Menu, Transition } from '@headlessui/react' import clsx from 'clsx' export function MenuButton(props: { - buttonContent: any + buttonContent: JSX.Element menuItems: { name: string; href: string; onClick?: () => void }[] className?: string }) { diff --git a/web/pages/simulator.tsx b/web/pages/simulator.tsx index dcf44478..dc6ca873 100644 --- a/web/pages/simulator.tsx +++ b/web/pages/simulator.tsx @@ -110,11 +110,13 @@ function TableRowEnd(props: { entry: Entry | null; isNew?: boolean }) { } } +type Bid = { yesBid: number; noBid: number } + function NewBidTable(props: { steps: number - bids: Array<{ yesBid: number; noBid: number }> + bids: Array setSteps: (steps: number) => void - setBids: (bids: any[]) => void + setBids: (bids: Array) => void }) { const { steps, bids, setSteps, setBids } = props // Prepare for new bids