diff --git a/functions/src/stripe.ts b/functions/src/stripe.ts index a52b0fae..d32010a6 100644 --- a/functions/src/stripe.ts +++ b/functions/src/stripe.ts @@ -5,11 +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 StripeTransaction = { userId: string manticDollarQuantity: number sessionId: string - session: any + session: StripeSession timestamp: number } @@ -96,14 +98,14 @@ export const stripeWebhook = functions } if (event.type === 'checkout.session.completed') { - const session = event.data.object as any + const session = event.data.object as StripeSession await issueMoneys(session) } res.status(200).send('success') }) -const issueMoneys = async (session: any) => { +const issueMoneys = async (session: StripeSession) => { const { id: sessionId } = session const query = await firestore diff --git a/web/components/SEO.tsx b/web/components/SEO.tsx index 8987d671..11e24c99 100644 --- a/web/components/SEO.tsx +++ b/web/components/SEO.tsx @@ -1,3 +1,4 @@ +import { ReactNode } from 'react' import Head from 'next/head' export type OgCardProps = { @@ -35,7 +36,7 @@ export function SEO(props: { title: string description: string url?: string - children?: any[] + children?: ReactNode ogCardProps?: OgCardProps }) { const { title, description, url, children, ogCardProps } = props diff --git a/web/components/advanced-panel.tsx b/web/components/advanced-panel.tsx index 1a8cf389..51caba67 100644 --- a/web/components/advanced-panel.tsx +++ b/web/components/advanced-panel.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx' -import { useState } from 'react' +import { useState, ReactNode } from 'react' -export function AdvancedPanel(props: { children: any }) { +export function AdvancedPanel(props: { children: ReactNode }) { const { children } = props const [collapsed, setCollapsed] = useState(true) diff --git a/web/components/avatar.tsx b/web/components/avatar.tsx index 706b61f3..8ae2a40d 100644 --- a/web/components/avatar.tsx +++ b/web/components/avatar.tsx @@ -1,5 +1,6 @@ import Router from 'next/router' import clsx from 'clsx' +import { MouseEvent } from 'react' import { UserCircleIcon } from '@heroicons/react/solid' export function Avatar(props: { @@ -15,7 +16,7 @@ export function Avatar(props: { const onClick = noLink && username ? undefined - : (e: any) => { + : (e: MouseEvent) => { e.stopPropagation() Router.push(`/${username}`) } diff --git a/web/components/confirmation-button.tsx b/web/components/confirmation-button.tsx index c23ec87c..e07b6dab 100644 --- a/web/components/confirmation-button.tsx +++ b/web/components/confirmation-button.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx' -import { useState } from 'react' +import { ReactNode, useState } from 'react' import { Col } from './layout/col' import { Modal } from './layout/modal' import { Row } from './layout/row' @@ -20,7 +20,7 @@ export function ConfirmationButton(props: { className?: string } onSubmit: () => void - children: any + children: ReactNode }) { const { id, openModalBtn, cancelBtn, submitBtn, onSubmit, children } = props diff --git a/web/components/join-spans.tsx b/web/components/join-spans.tsx index c11b4eed..2f071c82 100644 --- a/web/components/join-spans.tsx +++ b/web/components/join-spans.tsx @@ -1,14 +1,14 @@ import { ReactNode } from 'react' export const JoinSpans = (props: { - children: any[] + children: ReactNode[] separator?: ReactNode }) => { const { separator } = props const children = props.children.filter((x) => !!x) if (children.length === 0) return <> - if (children.length === 1) return children[0] + if (children.length === 1) return <>{children[0]} if (children.length === 2) return ( <> diff --git a/web/components/layout/col.tsx b/web/components/layout/col.tsx index 00e85532..74fad186 100644 --- a/web/components/layout/col.tsx +++ b/web/components/layout/col.tsx @@ -1,8 +1,8 @@ import clsx from 'clsx' -import { CSSProperties, Ref } from 'react' +import { CSSProperties, Ref, ReactNode } from 'react' export function Col(props: { - children?: any + children?: ReactNode className?: string style?: CSSProperties ref?: Ref diff --git a/web/components/layout/row.tsx b/web/components/layout/row.tsx index 5ccccd7b..1c69c252 100644 --- a/web/components/layout/row.tsx +++ b/web/components/layout/row.tsx @@ -1,7 +1,8 @@ import clsx from 'clsx' +import { ReactNode } from 'react' export function Row(props: { - children?: any + children?: ReactNode className?: string id?: string }) { diff --git a/web/components/number-input.tsx b/web/components/number-input.tsx index c40fadeb..d7159fab 100644 --- a/web/components/number-input.tsx +++ b/web/components/number-input.tsx @@ -1,4 +1,5 @@ import clsx from 'clsx' +import { ReactNode } from 'react' import React from 'react' import { Col } from './layout/col' @@ -14,7 +15,7 @@ export function NumberInput(props: { inputClassName?: string // Needed to focus the amount input inputRef?: React.MutableRefObject - children?: any + children?: ReactNode }) { const { numberString, diff --git a/web/components/page.tsx b/web/components/page.tsx index 64830181..421722a3 100644 --- a/web/components/page.tsx +++ b/web/components/page.tsx @@ -9,7 +9,7 @@ export function Page(props: { assertUser?: 'signed-in' | 'signed-out' rightSidebar?: ReactNode suspend?: boolean - children?: any + children?: ReactNode }) { const { margin, assertUser, children, rightSidebar, suspend } = props diff --git a/web/components/site-link.tsx b/web/components/site-link.tsx index cff47ea5..8137eb08 100644 --- a/web/components/site-link.tsx +++ b/web/components/site-link.tsx @@ -4,7 +4,7 @@ import Link from 'next/link' export const SiteLink = (props: { href: string - children?: any + children?: ReactNode onClick?: () => void className?: string }) => { diff --git a/web/components/yes-no-selector.tsx b/web/components/yes-no-selector.tsx index 38723060..25bdaaeb 100644 --- a/web/components/yes-no-selector.tsx +++ b/web/components/yes-no-selector.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx' -import React from 'react' +import React, { ReactNode } from 'react' import { formatMoney } from 'common/util/format' import { Col } from './layout/col' import { Row } from './layout/row' @@ -230,7 +230,7 @@ function Button(props: { className?: string onClick?: () => void color: 'green' | 'red' | 'blue' | 'yellow' | 'gray' - children?: any + children?: ReactNode }) { const { className, onClick, children, color } = props diff --git a/web/pages/simulator.tsx b/web/pages/simulator.tsx index bbf7408e..dcf44478 100644 --- a/web/pages/simulator.tsx +++ b/web/pages/simulator.tsx @@ -112,7 +112,7 @@ function TableRowEnd(props: { entry: Entry | null; isNew?: boolean }) { function NewBidTable(props: { steps: number - bids: any[] + bids: Array<{ yesBid: number; noBid: number }> setSteps: (steps: number) => void setBids: (bids: any[]) => void }) {