Clean up typing and formatting

This commit is contained in:
Connor Bryan 2018-07-12 13:04:22 -05:00
parent 6b2a8eedbc
commit 1c601f58e4
4 changed files with 17 additions and 6 deletions

View File

@ -18,7 +18,7 @@ interface OwnProps {
placeholder?: string;
value?: string;
dropdownThreshold?: number;
onChangeOverride?: (ev: React.FormEvent<HTMLInputElement>) => void;
onChangeOverride?(ev: React.FormEvent<HTMLInputElement>): void;
}
interface StateProps {

View File

@ -8,12 +8,24 @@ import { addressBookSelectors } from 'features/addressBook';
import { Address, Identicon } from 'components/ui';
import './AddressFieldDropdown.scss';
/**
* @desc The `onChangeOverride` prop needs to work
* with actual events, but also needs a value to be directly passed in
* occasionally. This interface allows us to skip all of the other FormEvent
* properties and methods.
*/
interface FakeFormEvent {
currentTarget: {
value: string;
};
}
interface StateProps {
value?: string;
dropdownThreshold?: number;
onChangeOverride?: (ev: React.FormEvent<HTMLInputElement>) => void;
labelAddresses: ReturnType<typeof addressBookSelectors.getLabelAddresses>;
currentTo: ReturnType<typeof transactionSelectors.getToRaw>;
onChangeOverride?(ev: React.FormEvent<HTMLInputElement> | FakeFormEvent): void;
}
interface DispatchProps {

View File

@ -18,8 +18,8 @@ interface OwnProps {
showIdenticon?: boolean;
value?: string;
dropdownThreshold?: number;
onChangeOverride?: (ev: React.FormEvent<HTMLInputElement>) => void;
withProps(props: CallbackProps): React.ReactElement<any> | null;
onChangeOverride?(ev: React.FormEvent<HTMLInputElement>): void;
}
interface State {
@ -113,8 +113,8 @@ interface DefaultAddressFieldProps {
showIdenticon?: boolean;
value?: string;
dropdownThreshold?: number;
onChangeOverride?: (ev: React.FormEvent<HTMLInputElement>) => void;
withProps(props: CallbackProps): React.ReactElement<any> | null;
onChangeOverride?(ev: React.FormEvent<HTMLInputElement>): void;
}
const DefaultAddressField: React.SFC<DefaultAddressFieldProps> = ({

View File

@ -32,8 +32,8 @@ interface OwnProps {
className?: string;
value?: string;
dropdownThreshold?: number;
onChangeOverride?: (ev: React.FormEvent<HTMLInputElement>) => void;
onChange(ev: React.FormEvent<HTMLInputElement>): void;
onChangeOverride?(ev: React.FormEvent<HTMLInputElement>): void;
onFocus(ev: React.FormEvent<HTMLInputElement>): void;
onBlur(ev: React.FormEvent<HTMLInputElement>): void;
withProps(props: CallbackProps): React.ReactElement<any> | null;
@ -63,7 +63,6 @@ type Props = OwnProps & StateProps;
class AddressInputFactoryClass extends Component<Props> {
public render() {
const {
className,
label,
currentTo,
onChange,