Change all project enums to objects with as const (#2445)

* feat: change all enums to as const objects

* Add word to dictionary

---------

Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
This commit is contained in:
Stepan Svechnikov
2023-12-22 10:25:00 +09:00
committed by GitHub
parent fd1ea5b4dc
commit a756a7697c
60 changed files with 790 additions and 666 deletions

View File

@ -11,13 +11,14 @@ import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
// <xsd:enumeration value="bottom"/>
// </xsd:restriction>
// </xsd:simpleType>
export enum VerticalAlign {
BOTTOM = "bottom",
CENTER = "center",
TOP = "top",
}
export const VerticalAlign = {
BOTTOM: "bottom",
CENTER: "center",
TOP: "top",
} as const;
export class VerticalAlignAttributes extends XmlAttributeComponent<{
readonly verticalAlign?: VerticalAlign;
readonly verticalAlign?: (typeof VerticalAlign)[keyof typeof VerticalAlign];
}> {
protected readonly xmlKeys = {
verticalAlign: "w:val",
@ -25,7 +26,7 @@ export class VerticalAlignAttributes extends XmlAttributeComponent<{
}
export class VerticalAlignElement extends XmlComponent {
public constructor(value: VerticalAlign) {
public constructor(value: (typeof VerticalAlign)[keyof typeof VerticalAlign]) {
super("w:vAlign");
this.root.push(new VerticalAlignAttributes({ verticalAlign: value }));
}