You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given the scenario where:
```javascript
const one = neo4j.int(1)
const two = neo4j.int(2)
```
The following operations was resulting in string concatenation:
```javascript
console.log( one + two ) // '12'
console.log( 1 + one ) // '11'
console.log( one.add(two).toInt() ) // 3, which is correct
console.log( '1' + one ) // '11', correct
```
This is issue is solved by defining the method `Integer.valueOf` which defines the primitive type representation. The primitive representation of `Integer` is set as `BigInt`.
This way:
```javascript
console.log( one + two ) // 3n
console.log( 1 + one ) // thrown an exception since we can not add bigint to number
console.log( 1n + one ) // 2n
console.log( -one ) // -1n
console.log( '1' + one ) // '11', correct
```
0 commit comments