move noImplicitAny and some type declarations
This commit is contained in:
parent
66a2006284
commit
f7a1a2ab58
@ -200,7 +200,7 @@ const MainWalletAction = styled(WalletAction)`
|
||||
color: ${({ theme }) => theme.primary1};
|
||||
`
|
||||
|
||||
function renderTransactions(transactions) {
|
||||
function renderTransactions(transactions: string[]) {
|
||||
return (
|
||||
<TransactionListWrapper>
|
||||
{transactions.map((hash, i) => {
|
||||
@ -212,8 +212,8 @@ function renderTransactions(transactions) {
|
||||
|
||||
interface AccountDetailsProps {
|
||||
toggleWalletModal: () => void
|
||||
pendingTransactions: any[]
|
||||
confirmedTransactions: any[]
|
||||
pendingTransactions: string[]
|
||||
confirmedTransactions: string[]
|
||||
ENSName?: string
|
||||
openOptions: () => void
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ export const Input = React.memo(function InnerInput({
|
||||
...rest
|
||||
}: {
|
||||
value: string | number
|
||||
onUserInput: (string) => void
|
||||
onUserInput: (input: string) => void
|
||||
error?: boolean
|
||||
fontSize?: string
|
||||
align?: 'right' | 'left'
|
||||
|
@ -44,7 +44,8 @@ export default function ListUpdatePopup({
|
||||
return diffTokenLists(oldList.tokens, newList.tokens)
|
||||
}, [newList.tokens, oldList.tokens])
|
||||
const numTokensChanged = useMemo(
|
||||
() => Object.keys(tokensChanged).reduce((memo, chainId) => memo + Object.keys(tokensChanged[chainId]).length, 0),
|
||||
() =>
|
||||
Object.keys(tokensChanged).reduce((memo, chainId: any) => memo + Object.keys(tokensChanged[chainId]).length, 0),
|
||||
[tokensChanged]
|
||||
)
|
||||
|
||||
|
@ -118,12 +118,12 @@ export default function SlippageTabs({ rawSlippage, setRawSlippage, deadline, se
|
||||
deadlineError = DeadlineError.InvalidInput
|
||||
}
|
||||
|
||||
function parseCustomSlippage(event) {
|
||||
setSlippageInput(event.target.value)
|
||||
function parseCustomSlippage(value: string) {
|
||||
setSlippageInput(value)
|
||||
|
||||
let valueAsIntFromRoundedFloat: number
|
||||
try {
|
||||
valueAsIntFromRoundedFloat = Number.parseInt((Number.parseFloat(event.target.value) * 100).toString())
|
||||
valueAsIntFromRoundedFloat = Number.parseInt((Number.parseFloat(value) * 100).toString())
|
||||
} catch {}
|
||||
|
||||
if (
|
||||
@ -135,12 +135,12 @@ export default function SlippageTabs({ rawSlippage, setRawSlippage, deadline, se
|
||||
}
|
||||
}
|
||||
|
||||
function parseCustomDeadline(event) {
|
||||
setDeadlineInput(event.target.value)
|
||||
function parseCustomDeadline(value: string) {
|
||||
setDeadlineInput(value)
|
||||
|
||||
let valueAsInt: number
|
||||
try {
|
||||
valueAsInt = Number.parseInt(event.target.value) * 60
|
||||
valueAsInt = Number.parseInt(value) * 60
|
||||
} catch {}
|
||||
|
||||
if (typeof valueAsInt === 'number' && !Number.isNaN(valueAsInt) && valueAsInt > 0) {
|
||||
@ -200,9 +200,9 @@ export default function SlippageTabs({ rawSlippage, setRawSlippage, deadline, se
|
||||
placeholder={(rawSlippage / 100).toFixed(2)}
|
||||
value={slippageInput}
|
||||
onBlur={() => {
|
||||
parseCustomSlippage({ target: { value: (rawSlippage / 100).toFixed(2) } })
|
||||
parseCustomSlippage((rawSlippage / 100).toFixed(2))
|
||||
}}
|
||||
onChange={parseCustomSlippage}
|
||||
onChange={e => parseCustomSlippage(e.target.value)}
|
||||
color={!slippageInputIsValid ? 'red' : ''}
|
||||
/>
|
||||
%
|
||||
@ -238,11 +238,11 @@ export default function SlippageTabs({ rawSlippage, setRawSlippage, deadline, se
|
||||
<Input
|
||||
color={!!deadlineError ? 'red' : undefined}
|
||||
onBlur={() => {
|
||||
parseCustomDeadline({ target: { value: (deadline / 60).toString() } })
|
||||
parseCustomDeadline((deadline / 60).toString())
|
||||
}}
|
||||
placeholder={(deadline / 60).toString()}
|
||||
value={deadlineInput}
|
||||
onChange={parseCustomDeadline}
|
||||
onChange={e => parseCustomDeadline(e.target.value)}
|
||||
/>
|
||||
</OptionCustom>
|
||||
<TYPE.body style={{ paddingLeft: '8px' }} fontSize={14}>
|
||||
|
@ -17,6 +17,7 @@ import { ReactComponent as Close } from '../../assets/images/x.svg'
|
||||
import { injected, fortmatic, portis } from '../../connectors'
|
||||
import { OVERLAY_READY } from '../../connectors/Fortmatic'
|
||||
import { WalletConnectConnector } from '@web3-react/walletconnect-connector'
|
||||
import { AbstractConnector } from '@web3-react/abstract-connector'
|
||||
|
||||
const CloseIcon = styled.div`
|
||||
position: absolute;
|
||||
@ -128,7 +129,7 @@ export default function WalletModal({
|
||||
|
||||
const [walletView, setWalletView] = useState(WALLET_VIEWS.ACCOUNT)
|
||||
|
||||
const [pendingWallet, setPendingWallet] = useState()
|
||||
const [pendingWallet, setPendingWallet] = useState<AbstractConnector | undefined>()
|
||||
|
||||
const [pendingError, setPendingError] = useState<boolean>()
|
||||
|
||||
@ -161,7 +162,7 @@ export default function WalletModal({
|
||||
}
|
||||
}, [setWalletView, active, error, connector, walletModalOpen, activePrevious, connectorPrevious])
|
||||
|
||||
const tryActivation = async connector => {
|
||||
const tryActivation = async (connector: AbstractConnector | undefined) => {
|
||||
let name = ''
|
||||
Object.keys(SUPPORTED_WALLETS).map(key => {
|
||||
if (connector === SUPPORTED_WALLETS[key].connector) {
|
||||
|
@ -19,7 +19,7 @@ const Message = styled.h2`
|
||||
color: ${({ theme }) => theme.secondary1};
|
||||
`
|
||||
|
||||
export default function Web3ReactManager({ children }) {
|
||||
export default function Web3ReactManager({ children }: { children: JSX.Element }): JSX.Element {
|
||||
const { t } = useTranslation()
|
||||
const { active } = useWeb3React()
|
||||
const { active: networkActive, error: networkError, activate: activateNetwork } = useWeb3React(NetworkContextName)
|
||||
|
@ -3,7 +3,7 @@ import ReactGA from 'react-ga'
|
||||
import { RouteComponentProps } from 'react-router-dom'
|
||||
|
||||
// fires a GA pageview every time the route changes
|
||||
export default function GoogleAnalyticsReporter({ location: { pathname, search } }: RouteComponentProps) {
|
||||
export default function GoogleAnalyticsReporter({ location: { pathname, search } }: RouteComponentProps): null {
|
||||
useEffect(() => {
|
||||
ReactGA.pageview(`${pathname}${search}`)
|
||||
}, [pathname, search])
|
||||
|
@ -16,6 +16,7 @@ export class FortmaticConnector extends FortmaticConnectorCore {
|
||||
async activate() {
|
||||
if (!this.fortmatic) {
|
||||
const { default: Fortmatic } = await import('fortmatic')
|
||||
|
||||
const { apiKey, chainId } = this as any
|
||||
if (chainId in CHAIN_ID_NETWORK_ARGUMENT) {
|
||||
this.fortmatic = new Fortmatic(apiKey, CHAIN_ID_NETWORK_ARGUMENT[chainId as FormaticSupportedChains])
|
||||
|
8
src/ethereum.d.ts
vendored
8
src/ethereum.d.ts
vendored
@ -1,8 +0,0 @@
|
||||
interface Window {
|
||||
ethereum?: {
|
||||
isMetaMask?: true
|
||||
on?: (...args: any[]) => void
|
||||
removeListener?: (...args: any[]) => void
|
||||
}
|
||||
web3?: {}
|
||||
}
|
8
src/hooks/ethereum.d.ts
vendored
8
src/hooks/ethereum.d.ts
vendored
@ -1,8 +0,0 @@
|
||||
interface Window {
|
||||
ethereum?: {
|
||||
isMetaMask?: true
|
||||
on?: (...args: any[]) => void
|
||||
removeListener?: (...args: any[]) => void
|
||||
}
|
||||
web3?: {}
|
||||
}
|
@ -83,7 +83,7 @@ function V1PairRemoval({
|
||||
})
|
||||
setPendingRemovalHash(response.hash)
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error: Error) => {
|
||||
console.error(error)
|
||||
setConfirmingRemoval(false)
|
||||
})
|
||||
|
25
src/react-app-env.d.ts
vendored
25
src/react-app-env.d.ts
vendored
@ -1 +1,26 @@
|
||||
/// <reference types="react-scripts" />
|
||||
|
||||
declare module 'jazzicon' {
|
||||
export default function(diameter: number, seed: number): HTMLElement
|
||||
}
|
||||
|
||||
declare module 'fortmatic'
|
||||
|
||||
interface Window {
|
||||
ethereum?: {
|
||||
isMetaMask?: true
|
||||
on?: (...args: any[]) => void
|
||||
removeListener?: (...args: any[]) => void
|
||||
}
|
||||
web3?: {}
|
||||
}
|
||||
|
||||
declare module 'content-hash' {
|
||||
declare function decode(x: string): string
|
||||
declare function getCodec(x: string): string
|
||||
}
|
||||
|
||||
declare module 'multihashes' {
|
||||
declare function decode(buff: Uint8Array): { code: number; name: string; length: number; digest: Uint8Array }
|
||||
declare function toB58String(hash: Uint8Array): string
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import useIsWindowVisible from '../../hooks/useIsWindowVisible'
|
||||
import { updateBlockNumber } from './actions'
|
||||
import { useDispatch } from 'react-redux'
|
||||
|
||||
export default function Updater() {
|
||||
export default function Updater(): null {
|
||||
const { library, chainId } = useActiveWeb3React()
|
||||
const dispatch = useDispatch()
|
||||
|
||||
|
@ -110,7 +110,7 @@ export function outdatedListeningKeys(
|
||||
})
|
||||
}
|
||||
|
||||
export default function Updater() {
|
||||
export default function Updater(): null {
|
||||
const dispatch = useDispatch<AppDispatch>()
|
||||
const state = useSelector<AppState, AppState['multicall']>(state => state.multicall)
|
||||
// wait for listeners to settle before triggering updates
|
||||
|
@ -26,7 +26,7 @@ export function shouldCheck(
|
||||
}
|
||||
}
|
||||
|
||||
export default function Updater() {
|
||||
export default function Updater(): null {
|
||||
const { chainId, library } = useActiveWeb3React()
|
||||
|
||||
const lastBlockNumber = useBlockNumber()
|
||||
|
@ -3,7 +3,7 @@ import { useDispatch } from 'react-redux'
|
||||
import { AppDispatch } from '../index'
|
||||
import { updateMatchesDarkMode } from './actions'
|
||||
|
||||
export default function Updater() {
|
||||
export default function Updater(): null {
|
||||
const dispatch = useDispatch<AppDispatch>()
|
||||
|
||||
// keep dark mode in sync with the system
|
||||
|
@ -5,7 +5,7 @@ import { parse } from 'qs'
|
||||
import { AppDispatch } from '../state'
|
||||
import { updateUserDarkMode } from '../state/user/actions'
|
||||
|
||||
export default function DarkModeQueryParamReader({ location: { search } }: RouteComponentProps) {
|
||||
export default function DarkModeQueryParamReader({ location: { search } }: RouteComponentProps): null {
|
||||
const dispatch = useDispatch<AppDispatch>()
|
||||
|
||||
useEffect(() => {
|
||||
|
4
src/utils/content-hash.d.ts
vendored
4
src/utils/content-hash.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
declare module 'content-hash' {
|
||||
declare function decode(x: string): string
|
||||
declare function getCodec(x: string): string
|
||||
}
|
4
src/utils/multihashes.d.ts
vendored
4
src/utils/multihashes.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
declare module 'multihashes' {
|
||||
declare function decode(buff: Uint8Array): { code: number; name: string; length: number; digest: Uint8Array }
|
||||
declare function toB58String(hash: Uint8Array): string
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
"module": "esnext",
|
||||
"noUnusedLocals": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"noImplicitReturns": true,
|
||||
"moduleResolution": "node",
|
||||
|
@ -2,7 +2,6 @@
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"alwaysStrict": true,
|
||||
"strictNullChecks": true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user