style: types

This commit is contained in:
wuji.xwt 2020-09-10 17:40:32 +08:00
parent b4a6d69727
commit cdad47fc94
4 changed files with 14 additions and 14 deletions

View File

@ -1,10 +1,10 @@
import { EventEmitter } from 'events';
import { ReactNode, ReactElement, RefObject, ComponentType } from 'react';
import { ReactNode, ComponentType } from 'react';
import { NpmInfo } from './npm';
import { RegisterOptions } from 'power-di';
export type KeyType = Function | symbol | string;
export type ClassType = Function | (new (...args: any[]) => any);
export type KeyType = new (...args: any[]) => any | symbol | string;
export type ClassType = new (...args: any[]) => any;
export interface GetOptions {
forceNew?: boolean;
sourceCls?: ClassType;
@ -48,7 +48,7 @@ export interface EditorConfig {
export interface SkeletonConfig {
config: NpmInfo;
props?: object;
props?: Record<string, unknown>;
handler?: (config: EditorConfig) => EditorConfig;
}
@ -78,13 +78,13 @@ export interface PluginConfig {
marked?: boolean;
align?: 'left' | 'right' | 'top' | 'bottom';
onClick?: () => void;
dialogProps?: object;
balloonProps?: object;
panelProps?: object;
linkProps?: object;
dialogProps?: Record<string, unknown>;
balloonProps?: Record<string, unknown>;
panelProps?: Record<string, unknown>;
linkProps?: Record<string, unknown>;
};
config?: NpmInfo;
pluginProps?: object;
pluginProps?: Record<string, unknown>;
}
export type HooksConfig = HookConfig[];
@ -110,7 +110,7 @@ export interface UtilConfig {
content: NpmInfo | ((...args: []) => any);
}
export type ConstantsConfig = object;
export type ConstantsConfig = Record<string, unknown>;
export interface LifeCyclesConfig {
init?: (editor: IEditor) => any;

View File

@ -40,7 +40,7 @@ export type DOMText = string;
export interface ContainerSchema extends NodeSchema {
componentName: string; // 'Block' | 'Page' | 'Component';
fileName: string;
meta?: object;
meta?: Record<string, unknown>;
state?: {
[key: string]: CompositeValue;
};

View File

@ -12,7 +12,7 @@ function isReactComponent(obj: any): obj is ComponentType<any> {
export type CustomView = ReactElement | ComponentType<any>;
export type DynamicProps = (target: SettingTarget) => object;
export type DynamicProps = (target: SettingTarget) => Record<string, unknown>;
export type DynamicSetter = (target: SettingTarget) => string | SetterConfig | CustomView;
export interface SetterConfig {
@ -23,7 +23,7 @@ export interface SetterConfig {
/**
* the props pass to Setter Component
*/
props?: object | DynamicProps;
props?: Record<string, unknown> | DynamicProps;
children?: any;
isRequired?: boolean;
initialValue?: any | ((target: SettingTarget) => any);

View File

@ -13,7 +13,7 @@ export interface TitleConfig {
export type TitleContent = string | I18nData | ReactElement | TitleConfig;
function isPlainObject(value: any): value is object {
function isPlainObject(value: any): value is Record<string, unknown> {
if (typeof value !== 'object') {
return false;
}