From c94a5307e3beaab79eeadfb35d1422ed3bcb44b8 Mon Sep 17 00:00:00 2001 From: YangusKhan <9inchsamurai@gmail.com> Date: Fri, 10 Aug 2018 09:32:28 -0600 Subject: [PATCH] remove type alias and use Record directly --- types/slate/index.d.ts | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/types/slate/index.d.ts b/types/slate/index.d.ts index 4eaa88a123..c5d92e0e80 100644 --- a/types/slate/index.d.ts +++ b/types/slate/index.d.ts @@ -10,13 +10,11 @@ // TypeScript Version: 2.3 import * as Immutable from 'immutable'; -type StringObject = Record; - export class Data { [key: string]: any; static create(options: Data): Data; - static fromJSON(object: StringObject): Data; - static fromJS(object: StringObject): Data; + static fromJSON(object: Record): Data; + static fromJS(object: Record): Data; } export interface RulesByNodeType { @@ -60,7 +58,7 @@ export interface Rules { normalize?: ( change: Change, reason: InvalidReason, - context: StringObject + context: Record ) => void; parent?: ObjectsAndTypes; text?: RegExp; @@ -109,7 +107,7 @@ export interface ValueProperties { selection?: Range; history?: History; schema?: Schema; - data?: StringObject; + data?: Record; decorations?: Immutable.List | null; } @@ -118,7 +116,7 @@ export interface ValueJSON { selection?: Range; history?: History; schema?: Schema; - data?: StringObject; + data?: Record; decorations?: Immutable.List | null; object?: 'value'; } @@ -128,7 +126,7 @@ export class Value extends Immutable.Record({}) { selection: Range; history: History; schema: Schema; - data: StringObject; + data: Record; object: 'value'; decorations: Immutable.List | null; @@ -184,17 +182,17 @@ export class Value extends Immutable.Record({}) { export interface DocumentProperties { nodes?: Immutable.List | Node[]; key?: string; - data?: Immutable.Map | StringObject; + data?: Immutable.Map | Record; } export interface DocumentJSON { nodes?: NodeJSON[]; key?: string; - data?: StringObject; + data?: Record; object?: 'document'; } -export class Document extends BaseNode< +export class Document> extends BaseNode< DataMap > { object: 'document'; @@ -215,7 +213,7 @@ export interface BlockProperties { key?: string; nodes?: Immutable.List; isVoid?: boolean; - data?: Immutable.Map | StringObject; + data?: Immutable.Map | Record; } export interface BlockJSON { @@ -223,7 +221,7 @@ export interface BlockJSON { key?: string; nodes?: NodeJSON[]; isVoid?: boolean; - data?: StringObject; + data?: Record; object: 'block'; } @@ -248,7 +246,7 @@ export interface InlineProperties { key?: string; nodes?: Immutable.List; isVoid?: boolean; - data?: Immutable.Map | StringObject; + data?: Immutable.Map | Record; } export interface InlineJSON { @@ -256,7 +254,7 @@ export interface InlineJSON { key?: string; nodes?: NodeJSON[]; isVoid?: boolean; - data?: StringObject; + data?: Record; object: 'inline'; } @@ -312,7 +310,7 @@ export type Node = Document | Block | Inline | Text; export type NodeJSON = DocumentJSON | BlockJSON | InlineJSON | TextJSON; // tslint:disable-next-line strict-export-declare-modifiers -declare class BaseNode extends Immutable.Record( +declare class BaseNode> extends Immutable.Record( {} ) { data: Immutable.Map; @@ -383,12 +381,12 @@ export class Character extends Immutable.Record({}) { export interface MarkProperties { type: string; - data?: Immutable.Map | StringObject; + data?: Immutable.Map | Record; } export interface MarkJSON { type: string; - data?: StringObject; + data?: Record; } export class Mark extends Immutable.Record({}) {