@@ -21,6 +21,7 @@ import { stringify } from './json'
21
21
22
22
type StandardDate = Date
23
23
type NumberOrInteger = number | Integer | bigint
24
+ type Properties = { [ key : string ] : any }
24
25
25
26
const IDENTIFIER_PROPERTY_ATTRIBUTES = {
26
27
value : true ,
@@ -43,18 +44,18 @@ function hasIdentifierProperty(obj: any, property: string): boolean {
43
44
/**
44
45
* Class for Node Type.
45
46
*/
46
- class Node < T extends NumberOrInteger = Integer > {
47
+ class Node < T extends NumberOrInteger = Integer , P extends Properties = Properties > {
47
48
identity : T
48
49
labels : string [ ]
49
- properties : any
50
+ properties : P
50
51
/**
51
52
* @constructor
52
53
* @protected
53
54
* @param {Integer|number } identity - Unique identity
54
55
* @param {Array<string> } labels - Array for all labels
55
- * @param {Object } properties - Map with node properties
56
+ * @param {Properties } properties - Map with node properties
56
57
*/
57
- constructor ( identity : T , labels : string [ ] , properties : any ) {
58
+ constructor ( identity : T , labels : string [ ] , properties : P ) {
58
59
/**
59
60
* Identity of the node.
60
61
* @type {Integer|number }
@@ -67,7 +68,7 @@ class Node<T extends NumberOrInteger = Integer> {
67
68
this . labels = labels
68
69
/**
69
70
* Properties of the node.
70
- * @type {Object }
71
+ * @type {Properties }
71
72
*/
72
73
this . properties = properties
73
74
}
@@ -112,12 +113,12 @@ function isNode(obj: object): obj is Node {
112
113
/**
113
114
* Class for Relationship Type.
114
115
*/
115
- class Relationship < T extends NumberOrInteger = Integer > {
116
+ class Relationship < T extends NumberOrInteger = Integer , P extends Properties = Properties > {
116
117
identity : T
117
118
start : T
118
119
end : T
119
120
type : string
120
- properties : any
121
+ properties : P
121
122
122
123
/**
123
124
* @constructor
@@ -126,9 +127,9 @@ class Relationship<T extends NumberOrInteger = Integer> {
126
127
* @param {Integer|number } start - Identity of start Node
127
128
* @param {Integer|number } end - Identity of end Node
128
129
* @param {string } type - Relationship type
129
- * @param {Object } properties - Map with relationship properties
130
+ * @param {Properties } properties - Map with relationship properties
130
131
*/
131
- constructor ( identity : T , start : T , end : T , type : string , properties : any ) {
132
+ constructor ( identity : T , start : T , end : T , type : string , properties : P ) {
132
133
/**
133
134
* Identity of the relationship.
134
135
* @type {Integer|number }
@@ -151,7 +152,7 @@ class Relationship<T extends NumberOrInteger = Integer> {
151
152
this . type = type
152
153
/**
153
154
* Properties of the relationship.
154
- * @type {Object }
155
+ * @type {Properties }
155
156
*/
156
157
this . properties = properties
157
158
}
@@ -194,17 +195,17 @@ function isRelationship(obj: object): obj is Relationship {
194
195
* Class for UnboundRelationship Type.
195
196
* @access private
196
197
*/
197
- class UnboundRelationship < T extends NumberOrInteger = Integer > {
198
+ class UnboundRelationship < T extends NumberOrInteger = Integer , P extends Properties = Properties > {
198
199
identity : T
199
200
type : string
200
- properties : any
201
+ properties : P
201
202
202
203
/**
203
204
* @constructor
204
205
* @protected
205
206
* @param {Integer|number } identity - Unique identity
206
207
* @param {string } type - Relationship type
207
- * @param {Object } properties - Map with relationship properties
208
+ * @param {Properties } properties - Map with relationship properties
208
209
*/
209
210
constructor ( identity : T , type : string , properties : any ) {
210
211
/**
@@ -219,7 +220,7 @@ class UnboundRelationship<T extends NumberOrInteger = Integer> {
219
220
this . type = type
220
221
/**
221
222
* Properties of the relationship.
222
- * @type {Object }
223
+ * @type {Properties }
223
224
*/
224
225
this . properties = properties
225
226
}
0 commit comments