Small cleanup to some common code (#422)

* Remove unnecessary type helpers

* Turn on unused code lint
This commit is contained in:
Marshall Polaris 2022-06-04 13:30:54 -07:00 committed by GitHub
parent b89753e1fe
commit f8c44efeba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 10 deletions

View File

@ -22,7 +22,6 @@ module.exports = {
], ],
rules: { rules: {
'no-extra-semi': 'off', 'no-extra-semi': 'off',
'no-unused-vars': 'off',
'no-constant-condition': ['error', { checkLoops: false }], 'no-constant-condition': ['error', { checkLoops: false }],
'lodash/import-scope': [2, 'member'], 'lodash/import-scope': [2, 'member'],
}, },

View File

@ -1,5 +0,0 @@
export type FirstArgument<T> = T extends (arg1: infer U, ...args: any[]) => any
? U
: any
export type Truthy<T> = Exclude<T, undefined | null | false | 0 | ''>

View File

@ -29,7 +29,6 @@ import { resolvedPayout } from 'common/calculate'
import { formatMoney } from 'common/util/format' import { formatMoney } from 'common/util/format'
import { useUserById } from 'web/hooks/use-users' import { useUserById } from 'web/hooks/use-users'
import { ContractTabs } from 'web/components/contract/contract-tabs' import { ContractTabs } from 'web/components/contract/contract-tabs'
import { FirstArgument } from 'common/util/types'
import { contractTextDetails } from 'web/components/contract/contract-details' import { contractTextDetails } from 'web/components/contract/contract-details'
import { useWindowSize } from 'web/hooks/use-window-size' import { useWindowSize } from 'web/hooks/use-window-size'
import Confetti from 'react-confetti' import Confetti from 'react-confetti'
@ -88,7 +87,7 @@ export default function ContractPage(props: {
return <ContractPageContent {...props} /> return <ContractPageContent {...props} />
} }
export function ContractPageContent(props: FirstArgument<typeof ContractPage>) { export function ContractPageContent(props: Parameters<typeof ContractPage>[0]) {
const { backToHome } = props const { backToHome } = props
const user = useUser() const user = useUser()

View File

@ -1,4 +1,3 @@
import { FirstArgument } from 'common/util/types'
import { Col } from 'web/components/layout/col' import { Col } from 'web/components/layout/col'
import { Spacer } from 'web/components/layout/spacer' import { Spacer } from 'web/components/layout/spacer'
import { fromPropz } from 'web/hooks/use-propz' import { fromPropz } from 'web/hooks/use-propz'
@ -10,7 +9,7 @@ import Analytics, {
export const getStaticProps = fromPropz(getStaticPropz) export const getStaticProps = fromPropz(getStaticPropz)
export default function AnalyticsEmbed(props: FirstArgument<typeof Analytics>) { export default function AnalyticsEmbed(props: Parameters<typeof Analytics>[0]) {
return ( return (
<Col className="w-full bg-white px-2"> <Col className="w-full bg-white px-2">
<CustomAnalytics {...props} /> <CustomAnalytics {...props} />