Improve types for Building across app

This commit is contained in:
Maciej Ziarkowski 2019-10-17 17:38:44 +01:00
parent c2396e8881
commit f54fcf0cc4
4 changed files with 13 additions and 7 deletions

View File

@ -8,9 +8,9 @@ interface BaseDataEntryProps {
title: string;
tooltip?: string;
disabled?: boolean;
copy: any; // CopyProps clashes with propTypes
mode: 'view' | 'edit' | 'multi-edit';
onChange: (key: string, value: any) => void;
copy?: any; // CopyProps clashes with propTypes
mode?: 'view' | 'edit' | 'multi-edit';
onChange?: (key: string, value: any) => void;
}
interface DataEntryProps extends BaseDataEntryProps {

View File

@ -9,6 +9,7 @@ import MultiEdit from './building/multi-edit';
import BuildingView from './building/building-view';
import ColouringMap from './map/map';
import { parse } from 'query-string';
import { Building } from './models/building';
interface MapAppRouteParams {
mode: 'view' | 'edit' | 'multi-edit';
@ -17,7 +18,7 @@ interface MapAppRouteParams {
}
interface MapAppProps extends RouteComponentProps<MapAppRouteParams> {
building: any;
building: Building;
building_like: boolean;
user: any;
}
@ -25,7 +26,7 @@ interface MapAppProps extends RouteComponentProps<MapAppRouteParams> {
interface MapAppState {
category: string;
revision_id: number;
building: any;
building: Building;
building_like: boolean;
}
@ -76,7 +77,7 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
}
}
selectBuilding(building) {
selectBuilding(building: Building) {
const mode = this.props.match.params.mode || 'view';
const category = this.props.match.params.category || 'age';

View File

@ -11,11 +11,12 @@ import Legend from './legend';
import { parseCategoryURL } from '../../parse';
import SearchBox from './search-box';
import ThemeSwitcher from './theme-switcher';
import { Building } from '../models/building';
const OS_API_KEY = 'NVUxtY5r8eA6eIfwrPTAGKrAAsoeI9E9';
interface ColouringMapProps {
building: any;
building: Building;
mode: 'basic' | 'view' | 'edit' | 'multi-edit';
category: string;
revision_id: number;

View File

@ -1,5 +1,9 @@
interface Building {
building_id: number;
geometry_id: number;
revision_id: number;
uprns: string[];
// TODO: add other fields as needed
}