From 9bf770d5a5508ae184ea35d7934210b81b381ec2 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 18 Dec 2024 13:19:12 +0200 Subject: [PATCH] Move interfaces --- .../apps/authoring-react/fields/boolean/editor.tsx | 5 ++--- scripts/apps/authoring-react/fields/boolean/index.ts | 11 +++++++++-- .../apps/authoring-react/fields/boolean/interfaces.ts | 3 --- .../apps/authoring-react/fields/boolean/preview.tsx | 7 ++++--- scripts/core/superdesk-api.d.ts | 5 +++++ 5 files changed, 20 insertions(+), 11 deletions(-) delete mode 100644 scripts/apps/authoring-react/fields/boolean/interfaces.ts diff --git a/scripts/apps/authoring-react/fields/boolean/editor.tsx b/scripts/apps/authoring-react/fields/boolean/editor.tsx index f2fabe6ec8..4ca9d73022 100644 --- a/scripts/apps/authoring-react/fields/boolean/editor.tsx +++ b/scripts/apps/authoring-react/fields/boolean/editor.tsx @@ -1,9 +1,8 @@ -import {ICommonFieldConfig, IEditorComponentProps} from 'superdesk-api'; +import {IBooleanFieldValueOperational, ICommonFieldConfig, IEditorComponentProps} from 'superdesk-api'; import * as React from 'react'; import {Switch} from 'superdesk-ui-framework/react'; -import {IValueOperational} from './interfaces'; -type IProps = IEditorComponentProps; +type IProps = IEditorComponentProps; export class Editor extends React.PureComponent { render() { diff --git a/scripts/apps/authoring-react/fields/boolean/index.ts b/scripts/apps/authoring-react/fields/boolean/index.ts index 4d4f775915..229692fc9b 100644 --- a/scripts/apps/authoring-react/fields/boolean/index.ts +++ b/scripts/apps/authoring-react/fields/boolean/index.ts @@ -1,13 +1,20 @@ import { + IBooleanFieldUserPreferences, + IBooleanFieldValueOperational, + IBooleanFieldValueStorage, ICommonFieldConfig, ICustomFieldType, } from 'superdesk-api'; import {gettext} from 'core/utils'; import {Editor} from './editor'; -import {IUserPreferences, IValueOperational, IValueStorage} from './interfaces'; import {Preview} from './preview'; -type IBooleanField = ICustomFieldType; +type IBooleanField = ICustomFieldType< + IBooleanFieldValueOperational, + IBooleanFieldValueStorage, + ICommonFieldConfig, + IBooleanFieldUserPreferences +>; export const getBooleanField = (): IBooleanField => { return { diff --git a/scripts/apps/authoring-react/fields/boolean/interfaces.ts b/scripts/apps/authoring-react/fields/boolean/interfaces.ts deleted file mode 100644 index 6b9fb91920..0000000000 --- a/scripts/apps/authoring-react/fields/boolean/interfaces.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type IValueOperational = boolean | null; -export type IValueStorage = IValueOperational; -export type IUserPreferences = never; diff --git a/scripts/apps/authoring-react/fields/boolean/preview.tsx b/scripts/apps/authoring-react/fields/boolean/preview.tsx index 1a058f04ad..ac9e0e10c0 100644 --- a/scripts/apps/authoring-react/fields/boolean/preview.tsx +++ b/scripts/apps/authoring-react/fields/boolean/preview.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; -import {ICommonFieldConfig, IPreviewComponentProps} from 'superdesk-api'; -import {IValueOperational} from './interfaces'; +import {IBooleanFieldValueOperational, ICommonFieldConfig, IPreviewComponentProps} from 'superdesk-api'; import {Switch} from 'superdesk-ui-framework/react'; import {noop} from 'lodash'; -export class Preview extends React.PureComponent> { +export class Preview extends React.PureComponent< + IPreviewComponentProps +> { render() { return (