forked from Florian-Merle/lang-el
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
75 lines (67 loc) · 1.75 KB
/
types.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// generate CONFIGURATION.md from this file by running "tsdoc --src=src/types.ts --dest=CONFIGURATION.md --noemoji --types"
/**
* The configuration object that is passed to `expressionlanguage` function
*/
export interface ExpressionLanguageConfig {
/** Type definitions used in `identifiers` & `functions` */
types?: { [key: string]: ELType };
/** Top-level variables */
identifiers?: ELIdentifier[];
/** Top-level functions */
functions?: ELFunction[];
}
export interface ELType {
/** Properties of the object */
identifiers?: ELIdentifier[];
/** Methods of the object */
functions?: ELFunction[];
info?: string;
}
/**
* Represents a variable or a property of an object
*/
export interface ELIdentifier {
name: string;
/** If set, this is shown instead of `type` */
detail?: string;
/** Text to show in hover tooltip, autocomplete etc. */
info?: string;
/** All possible types for this identifier */
type?: ELTypeName[];
}
/**
* Represents a function or a method of an object
*/
export interface ELFunction {
name: string;
args?: ELParameter[];
info?: string;
returnType?: ELTypeName[];
}
export interface ELParameter {
name: string;
type?: ELTypeName[];
info?: string;
optional?: boolean;
}
export interface ELKeyword {
name: string;
detail?: string;
info?: string;
}
export enum ELScalar {
/** Equivalent to PHP `bool` */
Bool = 'bool',
/** Equivalent to PHP `int` or `float` */
Number = 'number',
/** Equivalent to PHP `string` */
String = 'string',
/** Equivalent to PHP `null` */
Null = 'null',
/** Equivalent to PHP `mixed` */
Any = 'any',
}
/**
* One of predefined types (`ELScalar`) or a custom type from `ExpressionLanguageConfig.types`
*/
export type ELTypeName = ELScalar | string;