diff --git a/.travis.yml b/.travis.yml index ecf3e767..e0c9554a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,3 +16,4 @@ notifications: script: - npm run test - npm run tslint +- tsc --noEmit diff --git a/common/components/ui/Dropdown.tsx b/common/components/ui/Dropdown.tsx index c65d19c9..8fb664dd 100644 --- a/common/components/ui/Dropdown.tsx +++ b/common/components/ui/Dropdown.tsx @@ -3,7 +3,7 @@ import classnames from 'classnames'; import DropdownShell from './DropdownShell'; interface Props { - value: T; + value: T | undefined; options: T[]; ariaLabel: string; label?: string; diff --git a/common/components/ui/SimpleDropdown.tsx b/common/components/ui/SimpleDropdown.tsx index 74cc81d6..063a4c94 100644 --- a/common/components/ui/SimpleDropdown.tsx +++ b/common/components/ui/SimpleDropdown.tsx @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import Dropdown from './Dropdown'; interface Props { - value?: string; + value: string | undefined; options: string[]; ariaLabel?: string; onChange(value: string): void; @@ -19,7 +19,7 @@ export default class SimpleDropdown extends Component { options={options} value={value} onChange={onChange} - ariaLabel={ariaLabel || "dropdown"} + ariaLabel={ariaLabel || 'dropdown'} /> ); } diff --git a/common/containers/Tabs/SendTransaction/components/UnitDropdown.tsx b/common/containers/Tabs/SendTransaction/components/UnitDropdown.tsx index b4531fe7..5f697d0b 100644 --- a/common/containers/Tabs/SendTransaction/components/UnitDropdown.tsx +++ b/common/containers/Tabs/SendTransaction/components/UnitDropdown.tsx @@ -1,31 +1,38 @@ import React from 'react'; -import SimpleDropdown from 'components/ui/SimpleDropdown'; +import Dropdown from 'components/ui/Dropdown'; interface UnitDropdownProps { value: string; options: string[]; onChange?(value: string): void; } + interface State { expanded: boolean; } + +const initialState = { + expanded: false +}; + export default class UnitDropdown extends React.Component< UnitDropdownProps, State > { - public state = { - expanded: false - }; + public state: State = initialState; public render() { const { value, options } = this.props; + const StringDropdown = Dropdown as new () => Dropdown; + return (
-
);