Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
cazala committed Jul 16, 2019
1 parent 8b6a94a commit 5ea19a9
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 19 deletions.
5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
src
tsconfig.json
tslint.json
.nyc_output
.nyc_output
.git
.circleci
.vscode
10 changes: 6 additions & 4 deletions src/containers/Footer/Footer.container.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { connect } from 'react-redux'
import { RouterAction } from 'react-router-redux'
import { Locale } from 'decentraland-ui'

import Footer from './Footer'
import { FooterProps, MapDispatchProps, MapStateProps } from './Footer.types'
import { RootDispatch } from '../../types'
import { getLocale } from '../../modules/wallet/selectors'
import { isEnabled } from '../../modules/translation/selectors'
import { changeLocale } from '../../modules/translation/actions'
import {
changeLocale,
ChangeLocaleAction
} from '../../modules/translation/actions'

const mapState = (state: any): MapStateProps => {
return {
Expand All @@ -17,7 +19,7 @@ const mapState = (state: any): MapStateProps => {
}

const mapDispatch = (
dispatch: RootDispatch<RouterAction>
dispatch: RootDispatch<ChangeLocaleAction>
): MapDispatchProps => ({
onChange: (_, { value }) => dispatch(changeLocale(value as Locale))
})
Expand All @@ -36,4 +38,4 @@ export default connect(
mapState,
mapDispatch,
mergeProps
)(Footer)
)(Footer) as any
7 changes: 3 additions & 4 deletions src/containers/Modal/Modal.container.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { connect } from 'react-redux'
import { RouterAction } from 'react-router-redux'

import Modal from './Modal'
import { ModalProps, MapStateProps, MapDispatchProps } from './Modal.types'
import { RootDispatch } from '../../types'
import { closeModal } from '../../modules/modal/actions'
import { closeModal, CloseModalAction } from '../../modules/modal/actions'

const mapState = (_: any): MapStateProps => ({})

const mapDispatch = (
dispatch: RootDispatch<RouterAction>
dispatch: RootDispatch<CloseModalAction>
): MapDispatchProps => ({
onCloseModal: (name: string) => dispatch(closeModal(name))
})
Expand All @@ -28,4 +27,4 @@ export default connect(
mapState,
mapDispatch,
mergeProps
)(Modal)
)(Modal) as any
10 changes: 6 additions & 4 deletions src/containers/Navbar/Navbar.container.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { connect } from 'react-redux'
import { RouterAction } from 'react-router-redux'

import Navbar from './Navbar'
import { NavbarProps, MapStateProps, MapDispatchProps } from './Navbar.types'
Expand All @@ -10,7 +9,10 @@ import {
} from '../../modules/wallet/selectors'
import { isEnabled } from '../../modules/translation/selectors'
import { isSignIn } from '../../modules/location/selectors'
import { navigateToSignIn } from '../../modules/location/actions'
import {
navigateToSignIn,
NavigateToSignInAction
} from '../../modules/location/actions'
import { RootDispatch } from '../../types'

const mapState = (state: any): MapStateProps => {
Expand All @@ -26,7 +28,7 @@ const mapState = (state: any): MapStateProps => {
}

const mapDispatch = (
dispatch: RootDispatch<RouterAction>
dispatch: RootDispatch<NavigateToSignInAction>
): MapDispatchProps => ({
onSignIn: () => dispatch(navigateToSignIn())
})
Expand All @@ -45,4 +47,4 @@ export default connect(
mapState,
mapDispatch,
mergeProps
)(Navbar)
)(Navbar) as any
16 changes: 13 additions & 3 deletions src/containers/SignInPage/SignInPage.container.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { connect } from 'react-redux'

import SignInPage from './SignInPage'
import { MapDispatchProps, MapStateProps } from './SignInPage.types'
import {
MapDispatchProps,
MapStateProps,
SignInPageProps,
SignInPageState
} from './SignInPage.types'
import { RootDispatch } from '../../types'
import { isEnabled } from '../../modules/translation/selectors'
import { connectWalletRequest } from '../../modules/wallet/actions'
Expand All @@ -22,7 +27,12 @@ const mapDispatch = (dispatch: RootDispatch): MapDispatchProps => ({
onConnect: () => dispatch(connectWalletRequest())
})

export default connect(
export default connect<
MapStateProps,
MapDispatchProps,
SignInPageProps,
SignInPageState
>(
mapState,
mapDispatch
)(SignInPage)
)(SignInPage) as any
4 changes: 2 additions & 2 deletions src/containers/SignInPage/SignInPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import * as React from 'react'

import { SignIn, SignInI18N } from 'decentraland-ui'

import { SignInPageProps, SignInState } from './SignInPage.types'
import { SignInPageProps, SignInPageState } from './SignInPage.types'
import { T } from '../../modules/translation/utils'
import { isMobile } from '../../lib/utils'

export default class SignInPage extends React.PureComponent<
SignInPageProps,
SignInState
SignInPageState
> {
constructor(props: SignInPageProps) {
super(props)
Expand Down
2 changes: 1 addition & 1 deletion src/containers/SignInPage/SignInPage.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type SignInPageProps = SignInProps & {
hasTranslations?: boolean
}

export type SignInState = {
export type SignInPageState = {
hasError: boolean
}

Expand Down
2 changes: 2 additions & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
declare module 'react-intl'

export interface DataByKey<T> {
[key: string]: T
}
Expand Down

0 comments on commit 5ea19a9

Please sign in to comment.