Fix exception by moving to the better props type declaration.

Seems like a regression with React (or a deprecation?) as it used to
work. Though the separate interface style is better and works better
with typescript anyway.
master
Tom Hacohen 6 years ago
parent 2fd674a456
commit 82434cec2c

@ -111,7 +111,16 @@ const ValueTypeComponent = (props: ValueTypeComponentProps) => {
); );
}; };
class ContactEdit extends React.PureComponent { interface PropsType {
collections: Array<EteSync.CollectionInfo>;
initialCollection?: string;
item?: ContactType;
onSave: (contact: ContactType, journalUid: string, originalContact?: ContactType) => void;
onDelete: (contact: ContactType, journalUid: string) => void;
onCancel: () => void;
};
class ContactEdit extends React.PureComponent<PropsType> {
state: { state: {
uid: string, uid: string,
fn: string; fn: string;
@ -127,15 +136,6 @@ class ContactEdit extends React.PureComponent {
showDeleteDialog: boolean; showDeleteDialog: boolean;
}; };
props: {
collections: Array<EteSync.CollectionInfo>,
initialCollection?: string,
item?: ContactType,
onSave: (contact: ContactType, journalUid: string, originalContact?: ContactType) => void;
onDelete: (contact: ContactType, journalUid: string) => void;
onCancel: () => void;
};
constructor(props: any) { constructor(props: any) {
super(props); super(props);
this.state = { this.state = {

@ -30,7 +30,17 @@ import * as EteSync from '../api/EteSync';
import { EventType } from '../pim-types'; import { EventType } from '../pim-types';
class EventEdit extends React.PureComponent { interface PropsType {
collections: Array<EteSync.CollectionInfo>;
initialCollection?: string;
item?: EventType;
onSave: (event: EventType, journalUid: string, originalEvent?: EventType) => void;
onDelete: (event: EventType, journalUid: string) => void;
onCancel: () => void;
location: Location;
};
class EventEdit extends React.PureComponent<PropsType> {
state: { state: {
uid: string, uid: string,
title: string; title: string;
@ -45,16 +55,6 @@ class EventEdit extends React.PureComponent {
showDeleteDialog: boolean; showDeleteDialog: boolean;
}; };
props: {
collections: Array<EteSync.CollectionInfo>,
initialCollection?: string,
item?: EventType,
onSave: (event: EventType, journalUid: string, originalEvent?: EventType) => void;
onDelete: (event: EventType, journalUid: string) => void;
onCancel: () => void;
location: Location;
};
constructor(props: any) { constructor(props: any) {
super(props); super(props);
this.state = { this.state = {

Loading…
Cancel
Save