/
MethodDefinitionBase.ts
36 lines (33 loc) · 1.29 KB
/
MethodDefinitionBase.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
import type { FunctionExpression } from '../expression/FunctionExpression/spec';
import type { TSEmptyBodyFunctionExpression } from '../expression/TSEmptyBodyFunctionExpression/spec';
import type { Decorator } from '../special/Decorator/spec';
import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec';
import type {
PropertyName,
PropertyNameComputed,
PropertyNameNonComputed,
} from '../unions/PropertyName';
import type { Accessibility } from './Accessibility';
import type { BaseNode } from './BaseNode';
/** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */
interface MethodDefinitionBase extends BaseNode {
key: PropertyName;
value: FunctionExpression | TSEmptyBodyFunctionExpression;
computed: boolean;
static: boolean;
kind: 'constructor' | 'get' | 'method' | 'set';
optional?: boolean;
decorators?: Decorator[];
accessibility?: Accessibility;
typeParameters?: TSTypeParameterDeclaration;
override?: boolean;
}
export interface MethodDefinitionComputedNameBase extends MethodDefinitionBase {
key: PropertyNameComputed;
computed: true;
}
export interface MethodDefinitionNonComputedNameBase
extends MethodDefinitionBase {
key: PropertyNameNonComputed;
computed: false;
}