/
spec.ts
40 lines (37 loc) · 1.26 KB
/
spec.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
36
37
38
39
40
import type { AST_NODE_TYPES } from '../../ast-node-types';
import type { Accessibility } from '../../base/Accessibility';
import type { BaseNode } from '../../base/BaseNode';
import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec';
import type { TSTypeParameterDeclaration } from '../../special/TSTypeParameterDeclaration/spec';
import type { Parameter } from '../../unions/Parameter';
import type {
PropertyName,
PropertyNameComputed,
PropertyNameNonComputed,
} from '../../unions/PropertyName';
interface TSMethodSignatureBase extends BaseNode {
type: AST_NODE_TYPES.TSMethodSignature;
key: PropertyName;
computed: boolean;
params: Parameter[];
optional?: boolean;
returnType?: TSTypeAnnotation;
readonly?: boolean;
typeParameters?: TSTypeParameterDeclaration;
accessibility?: Accessibility;
export?: boolean;
static?: boolean;
kind: 'get' | 'method' | 'set';
}
export interface TSMethodSignatureComputedName extends TSMethodSignatureBase {
key: PropertyNameComputed;
computed: true;
}
export interface TSMethodSignatureNonComputedName
extends TSMethodSignatureBase {
key: PropertyNameNonComputed;
computed: false;
}
export type TSMethodSignature =
| TSMethodSignatureComputedName
| TSMethodSignatureNonComputedName;