Travis TypeScript Compiler Checking (#263)

* add typescript compliler check to travis

* fix existing typescript compiler errors
This commit is contained in:
Daniel Ternyak 2017-10-04 10:51:37 -07:00 committed by GitHub
parent a06298afa1
commit 74e51345a4
4 changed files with 17 additions and 9 deletions

View File

@ -16,3 +16,4 @@ notifications:
script:
- npm run test
- npm run tslint
- tsc --noEmit

View File

@ -3,7 +3,7 @@ import classnames from 'classnames';
import DropdownShell from './DropdownShell';
interface Props<T> {
value: T;
value: T | undefined;
options: T[];
ariaLabel: string;
label?: string;

View File

@ -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<Props, void> {
options={options}
value={value}
onChange={onChange}
ariaLabel={ariaLabel || "dropdown"}
ariaLabel={ariaLabel || 'dropdown'}
/>
);
}

View File

@ -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<string>;
return (
<div className="input-group-btn">
<SimpleDropdown
<StringDropdown
options={options}
value={value}
onChange={this.onChange}
options={options}
ariaLabel={'dropdown'}
/>
</div>
);