Skip to content

Commit c8d2ad9

Browse files
authored
Merge pull request #483 from ali-ince/1.7-type-fixes
Add Integer to typescript exported types
2 parents c5c0094 + 364c664 commit c8d2ad9

File tree

6 files changed

+35
-0
lines changed

6 files changed

+35
-0
lines changed

test/types/v1/graph-types.test.ts

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const node1String: string = node1.toString()
3131
const node1Id: Integer = node1.identity
3232
const node1Labels: string[] = node1.labels
3333
const node1Props: object = node1.properties
34+
const isNode1: boolean = node1 instanceof Node
3435

3536
const node2: Node<number> = new Node(2, ['Person', 'Employee'], {
3637
name: 'Alice'
@@ -46,6 +47,7 @@ const rel1Start: Integer = rel1.start
4647
const rel1End: Integer = rel1.end
4748
const rel1Type: string = rel1.type
4849
const rel1Props: object = rel1.properties
50+
const isRel1: boolean = rel1 instanceof Relationship
4951

5052
const rel2: UnboundRelationship = new UnboundRelationship(int(1), 'KNOWS', {
5153
since: 12345
@@ -55,13 +57,15 @@ const rel3: Relationship = rel2.bind(int(1), int(2))
5557
const rel2Id: Integer = rel2.identity
5658
const rel2Type: string = rel2.type
5759
const rel2Props: object = rel2.properties
60+
const isRel2: boolean = rel2 instanceof UnboundRelationship
5861

5962
const rel4: Relationship<number> = new Relationship(2, 3, 4, 'KNOWS', {
6063
since: 12345
6164
})
6265
const rel4Id: number = rel4.identity
6366
const rel4Start: number = rel4.start
6467
const rel4End: number = rel4.end
68+
const isRel4: boolean = rel4 instanceof Relationship
6569

6670
const rel5: UnboundRelationship<number> = new UnboundRelationship(5, 'KNOWS', {
6771
since: 12345
@@ -71,11 +75,13 @@ const rel6 = rel5.bind(24, 42)
7175
const rel6Id: number = rel6.identity
7276
const rel6Start: number = rel6.start
7377
const rel6End: number = rel6.end
78+
const isRel6: boolean = rel6 instanceof UnboundRelationship
7479

7580
const pathSegment1: PathSegment = new PathSegment(node1, rel1, node1)
7681
const pathSegment1Start: Node = pathSegment1.start
7782
const pathSegment1Rel: Relationship = pathSegment1.relationship
7883
const pathSegment1End: Node = pathSegment1.end
84+
const isPathSegment1: boolean = pathSegment1 instanceof PathSegment
7985

8086
const pathSegment2: PathSegment<number> = new PathSegment(node2, rel4, node2)
8187
const pathSegment2Start: Node<number> = pathSegment2.start
@@ -87,8 +93,10 @@ const path1Start: Node = path1.start
8793
const path1End: Node = path1.end
8894
const path1Segments: PathSegment[] = path1.segments
8995
const path1Length: number = path1.length
96+
const isPath1: boolean = path1 instanceof Path
9097

9198
const path2: Path<number> = new Path(node2, node2, [pathSegment2])
9299
const path2Start: Node<number> = path2.start
93100
const path2End: Node<number> = path2.end
94101
const path2Segments: PathSegment<number>[] = path2.segments
102+
const isPath2: boolean = path2 instanceof Path

test/types/v1/integer.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const int1 = new Integer()
2929
const int2 = new Integer(1)
3030
const int3 = new Integer(1, 2)
3131

32+
const isInt1 = int1 instanceof Integer
33+
const isInt2 = int2 instanceof Integer
34+
const isInt3 = int3 instanceof Integer
35+
3236
const high: number = int1.high
3337
const low: number = int1.low
3438

test/types/v1/record.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import Record from '../../../types/v1/record'
2121

2222
const record1 = new Record(['name', 'age'], ['Alice', 20])
2323
const record2 = new Record(['name', 'age'], ['Bob', 22], { key: 'value' })
24+
const isRecord1: boolean = record1 instanceof Record
25+
const isRecord2: boolean = record2 instanceof Record
2426

2527
const record1Keys: string[] = record1.keys
2628
const record1Length: number = record1.length

test/types/v1/spatial-types.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,27 @@ const point1: Point = new Point(int(1), 2, 3)
2424
const srid1: Integer = point1.srid
2525
const x1: number = point1.x
2626
const y1: number = point1.y
27+
const isInstance1: boolean = point1 instanceof Point
2728

2829
const point2: Point<number> = new Point(1, 2, 3)
2930
const srid2: number = point2.srid
3031
const x2: number = point2.x
3132
const y2: number = point2.y
33+
const isInstance2: boolean = point2 instanceof Point
3234

3335
const point3: Point = new Point(int(1), 2, 3, 4)
3436
const srid3: Integer = point3.srid
3537
const x3: number = point3.x
3638
const y3: number = point3.y
3739
const z3: number | undefined = point3.z
40+
const isInstance3: boolean = point3 instanceof Point
3841

3942
const point4: Point<number> = new Point(1, 2, 3, 4)
4043
const srid4: number = point4.srid
4144
const x4: number = point4.x
4245
const y4: number = point4.y
4346
const z4: number | undefined = point4.z
47+
const isInstance4: boolean = point4 instanceof Point
4448

4549
const isPoint1: boolean = isPoint(point1)
4650
const isPoint2: boolean = isPoint({})

test/types/v1/temporal-types.test.ts

+16
Original file line numberDiff line numberDiff line change
@@ -39,48 +39,56 @@ const months1: Integer = duration1.months
3939
const days1: Integer = duration1.days
4040
const seconds1: Integer = duration1.seconds
4141
const nanoseconds1: Integer = duration1.nanoseconds
42+
const durationIsInstance1: boolean = duration1 instanceof Duration
4243

4344
const duration2: Duration<number> = new Duration(1, 1, 1, 1)
4445
const months2: number = duration2.months
4546
const days2: number = duration2.days
4647
const seconds2: number = duration2.seconds
4748
const nanoseconds2: number = duration2.nanoseconds
49+
const durationIsInstance2: boolean = duration2 instanceof Duration
4850

4951
const localTime1: LocalTime = new LocalTime(int(1), int(1), int(1), int(1))
5052
const localTime1Hour1: Integer = localTime1.hour
5153
const localTime1Minute1: Integer = localTime1.minute
5254
const localTime1Second1: Integer = localTime1.second
5355
const localTime1Nanosecond1: Integer = localTime1.nanosecond
56+
const localTimeIsInstance1: boolean = localTime1 instanceof LocalTime
5457

5558
const localTime2: LocalTime<number> = new LocalTime(1, 1, 1, 1)
5659
const localTime2Hour1: number = localTime2.hour
5760
const localTime2Minute1: number = localTime2.minute
5861
const localTime2Second1: number = localTime2.second
5962
const localTime2Nanosecond1: number = localTime2.nanosecond
63+
const localTimeIsInstance2: boolean = localTime2 instanceof LocalTime
6064

6165
const time1: Time = new Time(int(1), int(1), int(1), int(1), int(1))
6266
const offset1: Integer = time1.timeZoneOffsetSeconds
6367
const hour1: Integer = time1.hour
6468
const minute1: Integer = time1.minute
6569
const second1: Integer = time1.second
6670
const nanosecond1: Integer = time1.nanosecond
71+
const timeIsInstance1: boolean = time1 instanceof Time
6772

6873
const time2: Time<number> = new Time(1, 1, 1, 1, 1)
6974
const offset2: number = time2.timeZoneOffsetSeconds
7075
const hour2: number = time2.hour
7176
const minute2: number = time2.minute
7277
const second2: number = time2.second
7378
const nanosecond2: number = time2.nanosecond
79+
const timeIsInstance2: boolean = time2 instanceof Time
7480

7581
const date1: Date = new Date(int(1), int(1), int(1))
7682
const date1Year1: Integer = date1.year
7783
const date1Month1: Integer = date1.month
7884
const date1Day1: Integer = date1.day
85+
const dateIsInstance1: boolean = date1 instanceof Date
7986

8087
const date2: Date<number> = new Date(1, 1, 1)
8188
const date2Year1: number = date2.year
8289
const date2Month1: number = date2.month
8390
const date2Day1: number = date2.day
91+
const dateIsInstance2: boolean = date2 instanceof Date
8492

8593
const localDateTime1: LocalDateTime = new LocalDateTime(
8694
int(1),
@@ -98,6 +106,8 @@ const hour3: Integer = localDateTime1.hour
98106
const minute3: Integer = localDateTime1.minute
99107
const second3: Integer = localDateTime1.second
100108
const nanosecond3: Integer = localDateTime1.nanosecond
109+
const localDateTimeIsInstance1: boolean =
110+
localDateTime1 instanceof LocalDateTime
101111

102112
const localDateTime2: LocalDateTime<number> = new LocalDateTime(
103113
1,
@@ -115,6 +125,8 @@ const hour4: number = localDateTime2.hour
115125
const minute4: number = localDateTime2.minute
116126
const second4: number = localDateTime2.second
117127
const nanosecond4: number = localDateTime2.nanosecond
128+
const localDateTimeIsInstance2: boolean =
129+
localDateTime2 instanceof LocalDateTime
118130

119131
const dateTime1: DateTime = new DateTime(
120132
int(1),
@@ -136,6 +148,7 @@ const hour5: Integer = dateTime1.hour
136148
const minute5: Integer = dateTime1.minute
137149
const second5: Integer = dateTime1.second
138150
const nanosecond5: Integer = dateTime1.nanosecond
151+
const dateTimeIsInstance1: boolean = dateTime1 instanceof DateTime
139152

140153
const dateTime2: DateTime<number> = new DateTime(
141154
1,
@@ -157,6 +170,7 @@ const hour6: number = dateTime2.hour
157170
const minute6: number = dateTime2.minute
158171
const second6: number = dateTime2.second
159172
const nanosecond6: number = dateTime2.nanosecond
173+
const dateTimeIsInstance2: boolean = dateTime2 instanceof DateTime
160174

161175
const dateTime3: DateTime = new DateTime(
162176
int(1),
@@ -178,6 +192,7 @@ const hour7: Integer = dateTime3.hour
178192
const minute7: Integer = dateTime3.minute
179193
const second7: Integer = dateTime3.second
180194
const nanosecond7: Integer = dateTime3.nanosecond
195+
const dateTimeIsInstance3: boolean = dateTime3 instanceof DateTime
181196

182197
const dateTime4: DateTime<number> = new DateTime(
183198
1,
@@ -199,6 +214,7 @@ const hour8: number = dateTime4.hour
199214
const minute8: number = dateTime4.minute
200215
const second8: number = dateTime4.second
201216
const nanosecond8: number = dateTime4.nanosecond
217+
const dateTimeIsInstance4: boolean = dateTime4 instanceof DateTime
202218

203219
const isDurationValue: boolean = isDuration(duration1)
204220
const isLocalTimeValue: boolean = isLocalTime(localTime1)

types/v1/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ declare const types: {
106106
Date: typeof Date
107107
LocalDateTime: typeof LocalDateTime
108108
DateTime: typeof DateTime
109+
Integer: typeof Integer
109110
}
110111

111112
declare const session: {

0 commit comments

Comments
 (0)