Skip to content

Commit

Permalink
feat(ts): optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed May 4, 2020
1 parent 4786784 commit 3737c68
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"jest-fetch-mock": "3.0.3",
"lint-staged": "9.4.0",
"mock-socket": "8.0.5",
"prettier": "1.18.2",
"prettier": "1.19.1",
"react-hot-loader": "4.12.20",
"react-intl-translations-manager": "5.0.3",
"redux-mock-store": "1.5.3",
Expand All @@ -195,7 +195,7 @@
"ts-jest": "25.3.1",
"ts-loader": "6.2.2",
"typecov": "0.2.1",
"typescript": "3.6.2",
"typescript": "3.8.3",
"webpack": "4.42.1",
"webpack-bundle-analyzer": "3.6.1",
"webpack-cli": "3.3.11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ class InitBorrowForm extends PureComponent<Props> {
const offers = this.props.offersR.getOrElse([])
const values = this.props.values

if (!values) return null
const offer = offers.find(
offer =>
offer.terms.collateralCcy === values.coin &&
offer.terms.collateralCcy === values?.coin &&
offer.terms.principalCcy === 'PAX'
)
return offer
Expand Down Expand Up @@ -113,7 +112,7 @@ class InitBorrowForm extends PureComponent<Props> {
<TooltipIcon name='info' size='12px' />
</TooltipHost>
</Text>
<Amount {...this.props.values} />
<Amount {...(this.props.values || { coin: 'BTC' })} />
<HorizontalBorder />
<FormGroup>
<CustomFormLabel>
Expand Down Expand Up @@ -187,18 +186,15 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({
modalActions: bindActionCreators(actions.modals, dispatch)
})

const connector = connect(
mapStateToProps,
mapDispatchToProps
)
const connector = connect(mapStateToProps, mapDispatchToProps)

type OwnProps = {
isDisabled: boolean
}
type LinkStatePropsType = {
offersR: RemoteDataType<NabuApiErrorType, Array<OfferType>>
userHistoryR: RemoteDataType<NabuApiErrorType, Array<LoanType>>
values: {
values?: {
coin: CoinType
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { CoinType, FiatType, RemoteDataType, SBOrderType } from 'core/types'
import { ProcessedTxType } from 'core/transactions/types'
import {
CoinType,
FiatType,
ProcessedTxType,
RemoteDataType,
SBOrderType
} from 'core/types'
import DataError from 'components/DataError'
import Loading from './template.loading'
import React, { PureComponent } from 'react'
Expand Down
1 change: 1 addition & 0 deletions packages/blockchain-wallet-v4/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ export * from '../network/api/simpleBuy/types'
export * from '../exchange/currencies'
export * from '../network/types'
export * from '../remote/types'
export * from '../transactions/types'
export * from '../types/index'
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14428,10 +14428,10 @@ preserve@^0.2.0:
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=

prettier@1.18.2:
version "1.18.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
prettier@1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==

pretty-error@^2.1.1:
version "2.1.1"
Expand Down Expand Up @@ -18049,10 +18049,10 @@ typescript-tuple@^2.2.1:
dependencies:
typescript-compare "^0.0.2"

typescript@3.6.2:
version "3.6.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54"
integrity sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw==
typescript@3.8.3:
version "3.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==

u2f-api@0.2.7:
version "0.2.7"
Expand Down

0 comments on commit 3737c68

Please sign in to comment.