From 82434cec2c3bb7a78c48d1258088ef12b6e9f689 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 14 Feb 2019 11:05:54 +0000 Subject: [PATCH] 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. --- src/components/ContactEdit.tsx | 20 ++++++++++---------- src/components/EventEdit.tsx | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/components/ContactEdit.tsx b/src/components/ContactEdit.tsx index 326946d..1a1871f 100644 --- a/src/components/ContactEdit.tsx +++ b/src/components/ContactEdit.tsx @@ -111,7 +111,16 @@ const ValueTypeComponent = (props: ValueTypeComponentProps) => { ); }; -class ContactEdit extends React.PureComponent { +interface PropsType { + collections: Array; + 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 { state: { uid: string, fn: string; @@ -127,15 +136,6 @@ class ContactEdit extends React.PureComponent { showDeleteDialog: boolean; }; - props: { - collections: Array, - initialCollection?: string, - item?: ContactType, - onSave: (contact: ContactType, journalUid: string, originalContact?: ContactType) => void; - onDelete: (contact: ContactType, journalUid: string) => void; - onCancel: () => void; - }; - constructor(props: any) { super(props); this.state = { diff --git a/src/components/EventEdit.tsx b/src/components/EventEdit.tsx index 832f0c1..a0dbac9 100644 --- a/src/components/EventEdit.tsx +++ b/src/components/EventEdit.tsx @@ -30,7 +30,17 @@ import * as EteSync from '../api/EteSync'; import { EventType } from '../pim-types'; -class EventEdit extends React.PureComponent { +interface PropsType { + collections: Array; + 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 { state: { uid: string, title: string; @@ -45,16 +55,6 @@ class EventEdit extends React.PureComponent { showDeleteDialog: boolean; }; - props: { - collections: Array, - 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) { super(props); this.state = {