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 { IndentJSON } from "./indent";
import {
CommentRangeStartJSON,
CommentRangeEndJSON,
CommentRangeStartJSON,
SectionPropertyJSON,
} from "..";
import { LineSpacingJSON } from "./line_spacing";
@ -61,43 +61,47 @@ export type ParagraphJSON = {
};
};
export type InsertJSONData = {
children: (
| DeleteJSON
| RunJSON
| CommentRangeStartJSON
| CommentRangeEndJSON
)[];
author: string;
date: string;
};
export type InsertJSON = {
type: "insert";
data: {
children: (
| DeleteJSON
| RunJSON
| CommentRangeStartJSON
| CommentRangeEndJSON
)[];
author: string;
date: string;
};
data: InsertJSONData;
};
export type DeleteJSONData = {
children: DeleteChildJSON[];
author: string;
date: string;
};
export type DeleteJSON = {
type: "delete";
data: {
children: DeleteChildJSON[];
author: string;
date: string;
};
data: DeleteJSONData;
};
export type HyperlinkJSON = {
type: "hyperlink";
data:
| {
type: "external";
rid: string;
children: HyperlinkChildJSON[];
history: number | null;
}
| {
type: "anchor";
anchor: string;
children: HyperlinkChildJSON[];
};
| {
type: "external";
rid: string;
children: HyperlinkChildJSON[];
history: number | null;
}
| {
type: "anchor";
anchor: string;
children: HyperlinkChildJSON[];
};
};
export type DeleteChildJSON =

View File

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