forked from dsherret/ts-morph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MethodSignature.ts
35 lines (31 loc) · 1.34 KB
/
MethodSignature.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
32
33
34
35
import { removeInterfaceMember } from "../../../manipulation";
import { MethodSignatureStructure, MethodSignatureSpecificStructure } from "../../../structures";
import { ts } from "../../../typescript";
import { ChildOrderableNode, JSDocableNode, PropertyNamedNode, QuestionTokenableNode, SignaturedDeclaration, TypeParameteredNode } from "../base";
import { callBaseSet } from "../callBaseSet";
import { TypeElement } from "./TypeElement";
import { callBaseGetStructure } from "../callBaseGetStructure";
export const MethodSignatureBase = ChildOrderableNode(JSDocableNode(QuestionTokenableNode(TypeParameteredNode(SignaturedDeclaration(PropertyNamedNode(TypeElement))))));
export class MethodSignature extends MethodSignatureBase<ts.MethodSignature> {
/**
* Removes this method signature.
*/
remove() {
removeInterfaceMember(this);
}
/**
* Sets the node from a structure.
* @param structure - Structure to set the node with.
*/
set(structure: Partial<MethodSignatureStructure>) {
callBaseSet(MethodSignatureBase.prototype, this, structure);
return this;
}
/**
* Gets the structure equivalent to this node.
*/
getStructure(): MethodSignatureStructure {
return callBaseGetStructure<MethodSignatureSpecificStructure>(MethodSignatureBase.prototype, this, {
});
}
}