tightened type checking for tab stops
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Attributes, XmlComponent } from "../xml-components";
|
||||
import { XmlAttributeComponent, XmlComponent } from "../xml-components";
|
||||
|
||||
class TabStop extends XmlComponent {
|
||||
|
||||
@ -8,11 +8,17 @@ class TabStop extends XmlComponent {
|
||||
}
|
||||
}
|
||||
|
||||
export type tabOptions = "left" | "right";
|
||||
|
||||
class TabAttributes extends XmlAttributeComponent<{val: tabOptions, pos: string | number}> {
|
||||
protected xmlKeys = {val: "w:val", pos: "w:pos"};
|
||||
}
|
||||
|
||||
class Tab extends XmlComponent {
|
||||
|
||||
constructor(value: string, position: string | number) {
|
||||
constructor(value: tabOptions, position: string | number) {
|
||||
super("w:tab");
|
||||
this.root.push(new Attributes({
|
||||
this.root.push(new TabAttributes({
|
||||
val: value,
|
||||
pos: position,
|
||||
}));
|
||||
|
Reference in New Issue
Block a user