forked from dsherret/ts-morph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPropertySignature.ts
31 lines (28 loc) · 1.33 KB
/
PropertySignature.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { PropertySignatureStructure, PropertySignatureSpecificStructure, StructureKind } from "../../../structures";
import { ts } from "../../../typescript";
import { ChildOrderableNode, InitializerExpressionableNode, JSDocableNode, ModifierableNode, PropertyNamedNode,
QuestionTokenableNode, ReadonlyableNode, TypedNode } from "../base";
import { callBaseSet } from "../callBaseSet";
import { TypeElement } from "./TypeElement";
import { callBaseGetStructure } from "../callBaseGetStructure";
export const PropertySignatureBase = ChildOrderableNode(JSDocableNode(ReadonlyableNode(QuestionTokenableNode(InitializerExpressionableNode(TypedNode(
PropertyNamedNode(ModifierableNode(TypeElement))
))))));
export class PropertySignature extends PropertySignatureBase<ts.PropertySignature> {
/**
* Sets the node from a structure.
* @param structure - Structure to set the node with.
*/
set(structure: Partial<PropertySignatureStructure>) {
callBaseSet(PropertySignatureBase.prototype, this, structure);
return this;
}
/**
* Gets the structure equivalent to this node.
*/
getStructure(): PropertySignatureStructure {
return callBaseGetStructure<PropertySignatureSpecificStructure>(PropertySignatureBase.prototype, this, {
kind: StructureKind.PropertySignature
});
}
}