diff --git a/package.json b/package.json index 569729e8734..f2e501809c2 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "ts-node": "^8.3.0", "tsconfig-paths": "^3.8.0", "tslint": "^5.20.0", - "typescript": "^3.5.3", + "typescript": "^3.7.3", "typescript-tslint-plugin": "^0.5.4" }, "dependencies": { diff --git a/packages/blockchain-api/package.json b/packages/blockchain-api/package.json index d6ad93b5723..d8ed27a330e 100644 --- a/packages/blockchain-api/package.json +++ b/packages/blockchain-api/package.json @@ -36,7 +36,7 @@ "@types/web3": "^1.0.18", "jest-fetch-mock": "^2.1.2", "tsc-watch": "^1.0.31", - "typescript": "^3.5.3" + "typescript": "^3.7.3" }, "resolutions": { "**/cross-fetch": "3.0.4" diff --git a/packages/celotool/src/cmds/deploy/upgrade/ethstats.ts b/packages/celotool/src/cmds/deploy/upgrade/ethstats.ts index cd7fa33222f..b127f4299f3 100644 --- a/packages/celotool/src/cmds/deploy/upgrade/ethstats.ts +++ b/packages/celotool/src/cmds/deploy/upgrade/ethstats.ts @@ -23,7 +23,7 @@ export const handler = async (argv: EthstatsArgv) => { await createClusterIfNotExists() await switchToClusterFromEnv() - if (argv.reset) { + if (argv.reset === true) { await removeHelmRelease(argv.celoEnv) await installHelmChart(argv.celoEnv) } else { diff --git a/packages/celotool/src/cmds/deploy/upgrade/leaderboard.ts b/packages/celotool/src/cmds/deploy/upgrade/leaderboard.ts index 059eea67fd0..376ba09030f 100644 --- a/packages/celotool/src/cmds/deploy/upgrade/leaderboard.ts +++ b/packages/celotool/src/cmds/deploy/upgrade/leaderboard.ts @@ -23,7 +23,7 @@ export const handler = async (argv: LeaderboardArgv) => { await createClusterIfNotExists() await switchToClusterFromEnv() - if (argv.reset) { + if (argv.reset === true) { await removeHelmRelease(argv.celoEnv) await installHelmChart(argv.celoEnv) } else { diff --git a/packages/celotool/src/cmds/deploy/upgrade/testnet.ts b/packages/celotool/src/cmds/deploy/upgrade/testnet.ts index 1cae9afa895..9a0df3bb5f9 100644 --- a/packages/celotool/src/cmds/deploy/upgrade/testnet.ts +++ b/packages/celotool/src/cmds/deploy/upgrade/testnet.ts @@ -31,7 +31,7 @@ export const handler = async (argv: TestnetArgv) => { await upgradeStaticIPs(argv.celoEnv) - if (argv.reset) { + if (argv.reset === true) { await resetAndUpgradeHelmChart(argv.celoEnv) await uploadGenesisBlockToGoogleStorage(argv.celoEnv) } else { diff --git a/packages/celotool/src/cmds/deploy/upgrade/vm-testnet.ts b/packages/celotool/src/cmds/deploy/upgrade/vm-testnet.ts index aaa1d69e04d..7f0b5721e9b 100644 --- a/packages/celotool/src/cmds/deploy/upgrade/vm-testnet.ts +++ b/packages/celotool/src/cmds/deploy/upgrade/vm-testnet.ts @@ -31,7 +31,7 @@ export const handler = async (argv: VmTestnetArgv) => { await switchToClusterFromEnv() let onDeployFailed = () => Promise.resolve() - if (argv.reset) { + if (argv.reset === true) { onDeployFailed = () => untaintTestnet(argv.celoEnv) await taintTestnet(argv.celoEnv) } diff --git a/packages/cli/package.json b/packages/cli/package.json index dccaa4b8449..bae8ef91cb4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -67,7 +67,7 @@ "@types/web3": "^1.0.18", "globby": "^8", "prettier": "1.13.5", - "typescript": "^3.5.3" + "typescript": "^3.7.3" }, "files": [ "README.md", diff --git a/packages/notification-service/package.json b/packages/notification-service/package.json index bce9ae88696..642b629c631 100644 --- a/packages/notification-service/package.json +++ b/packages/notification-service/package.json @@ -39,7 +39,7 @@ "@types/node-fetch": "^2.1.2", "@types/utf8": "^2.1.6", "@types/web3": "^1.0.18", - "typescript": "^3.5.3" + "typescript": "^3.7.3" }, "engines": { "node": "10" diff --git a/packages/react-components/analytics/wrapper.tsx b/packages/react-components/analytics/wrapper.tsx index fedb2665d74..1cd99e41136 100644 --- a/packages/react-components/analytics/wrapper.tsx +++ b/packages/react-components/analytics/wrapper.tsx @@ -4,29 +4,45 @@ import CeloAnalyticsType from '@celo/react-components/analytics/CeloAnalytics' import { DefaultEventNames } from '@celo/react-components/analytics/constants' import ReactNativeLogger from '@celo/react-components/services/ReactNativeLogger' import * as React from 'react' +// tslint:disable-next-line +import { Component, ComponentType, forwardRef, Ref } from 'react' function getDisplayName

(WrappedComponent: React.ComponentType

) { return WrappedComponent.displayName || WrappedComponent.name || 'Component' } -interface ForwardedRef { - forwardedRef?: React.Ref> -} - export default function Initializer(CeloAnalytics: CeloAnalyticsType, Logger: ReactNativeLogger) { - // Wrapper type: https://medium.com/@jrwebdev/react-higher-order-component-patterns-in-typescript-42278f7590fb + // Wrapper type: https://gist.github.com/OliverJAsh/d2f462b03b3e6c24f5588ca7915d010e // Component name: https://reactjs.org/docs/forwarding-refs.html - function componentWithAnalytics

( - WrappedComponent: React.ComponentType

- ): React.ComponentClass

{ - const displayName = getDisplayName(WrappedComponent) + function componentWithAnalytics( + ComposedComponent: ComponentType + ) { + const displayName = getDisplayName(ComposedComponent) + // @ts-ignore + type ComposedComponentInstance = InstanceType + type WrapperComponentProps = ComposedComponentProps & { + wrapperComponentProp: number + } + type WrapperComponentPropsWithForwardedRef = WrapperComponentProps & { + forwardedRef: Ref + } - class ComponentWithAnalytics extends React.Component

{ + class WrapperComponent extends Component { timestamp: number | undefined render() { - return + const { forwardedRef, wrapperComponentProp, ...composedComponentProps } = this.props + + return ( + + ) } trackEvent(event: any, props: any, attachDeviceInfo = false) { @@ -58,13 +74,16 @@ export default function Initializer(CeloAnalytics: CeloAnalyticsType, Logger: Re } } - function forwardRef(props: P, ref: any) { - return + function forward(props: WrapperComponentProps, ref: Ref) { + return } - forwardRef.displayName = `WithAnalytics(${displayName})` + forward.displayName = `WithAnalytics(${displayName})` - return hoistNonReactStatics(React.forwardRef(forwardRef), WrappedComponent) + return hoistNonReactStatics( + forwardRef(forward), + ComposedComponent + ) } return componentWithAnalytics } diff --git a/packages/react-components/components/TextInput.tsx b/packages/react-components/components/TextInput.tsx index 20d5650e8bc..ac5645eee42 100644 --- a/packages/react-components/components/TextInput.tsx +++ b/packages/react-components/components/TextInput.tsx @@ -11,7 +11,7 @@ import { StyleSheet, TextInput as RNTextInput, TextInputFocusEventData, - TextInputProps, + TextInputProps as RNTextInputProps, View, } from 'react-native' @@ -22,7 +22,7 @@ interface OwnProps { forwardedRef?: React.RefObject } -type Props = OwnProps & TextInputProps +type Props = OwnProps & RNTextInputProps interface State { isFocused: boolean diff --git a/yarn.lock b/yarn.lock index 8ccb54161ef..0b4b4ef883d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -32013,16 +32013,16 @@ typescript@^3.2.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3.tgz#f1657fc7daa27e1a8930758ace9ae8da31403221" integrity sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A== -typescript@^3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" - integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== - typescript@^3.6.4: version "3.6.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg== +typescript@^3.7.3: + version "3.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69" + integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw== + typewise-core@^1.2, typewise-core@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/typewise-core/-/typewise-core-1.2.0.tgz#97eb91805c7f55d2f941748fa50d315d991ef195"