refactor: define type instead of IndexAccessType (#549)

main
skanehira 2022-10-26 16:37:43 +09:00 committed by GitHub
parent 0ab6c08ea1
commit 3609b7e639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 39 deletions

View File

@ -1,8 +1,8 @@
import { RunJSON, RunPropertyJSON } from "./run"; import { RunJSON, RunPropertyJSON } from "./run";
import { IndentJSON } from "./indent"; import { IndentJSON } from "./indent";
import { import {
CommentRangeStartJSON,
CommentRangeEndJSON, CommentRangeEndJSON,
CommentRangeStartJSON,
SectionPropertyJSON, SectionPropertyJSON,
} from ".."; } from "..";
import { LineSpacingJSON } from "./line_spacing"; import { LineSpacingJSON } from "./line_spacing";
@ -61,9 +61,7 @@ export type ParagraphJSON = {
}; };
}; };
export type InsertJSON = { export type InsertJSONData = {
type: "insert";
data: {
children: ( children: (
| DeleteJSON | DeleteJSON
| RunJSON | RunJSON
@ -72,16 +70,22 @@ export type InsertJSON = {
)[]; )[];
author: string; author: string;
date: string; date: string;
}; };
export type InsertJSON = {
type: "insert";
data: InsertJSONData;
};
export type DeleteJSONData = {
children: DeleteChildJSON[];
author: string;
date: string;
}; };
export type DeleteJSON = { export type DeleteJSON = {
type: "delete"; type: "delete";
data: { data: DeleteJSONData;
children: DeleteChildJSON[];
author: string;
date: string;
};
}; };
export type HyperlinkJSON = { export type HyperlinkJSON = {

View File

@ -1,8 +1,7 @@
import { DrawingJSON } from "./drawing"; import { DrawingJSON } from "./drawing";
import { ShapeJSON } from "./shape"; import { ShapeJSON } from "./shape";
import { CommentRangeStartJSON, CommentRangeEndJSON } from ".."; import { CommentRangeStartJSON, CommentRangeEndJSON, InsertJSONData, DeleteJSONData } from "..";
import { BorderType } from "../border"; import { BorderType } from "../border";
import { InsertJSON, DeleteJSON } from "./paragraph";
import { VertAlignType } from "../run"; import { VertAlignType } from "../run";
import { FieldChar } from "./bindings/FieldChar"; import { FieldChar } from "./bindings/FieldChar";
import { InstrHyperlink } from "./bindings/InstrHyperlink"; import { InstrHyperlink } from "./bindings/InstrHyperlink";
@ -43,8 +42,8 @@ export type RunPropertyJSON = {
vanish?: boolean | null; vanish?: boolean | null;
spacing?: number | null; spacing?: number | null;
textBorder?: TextBorderJSON | null; textBorder?: TextBorderJSON | null;
ins?: InsertJSON["data"] | null; ins?: InsertJSONData | null;
del?: DeleteJSON["data"] | null; del?: DeleteJSONData | null;
strike?: boolean; strike?: boolean;
}; };