1+ import type { Timestamp } from './timestamp' ;
12import type { EJSONOptions } from './extended_json' ;
23import { isObjectLike } from './parser/utils' ;
34
@@ -297,7 +298,7 @@ export class Long {
297298 }
298299
299300 /** Returns the sum of this and the specified Long. */
300- add ( addend : string | number | Long ) : Long {
301+ add ( addend : string | number | Long | Timestamp ) : Long {
301302 if ( ! Long . isLong ( addend ) ) addend = Long . fromValue ( addend ) ;
302303
303304 // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
@@ -334,7 +335,7 @@ export class Long {
334335 * Returns the sum of this and the specified Long.
335336 * @returns Sum
336337 */
337- and ( other : string | number | Long ) : Long {
338+ and ( other : string | number | Long | Timestamp ) : Long {
338339 if ( ! Long . isLong ( other ) ) other = Long . fromValue ( other ) ;
339340 return Long . fromBits ( this . low & other . low , this . high & other . high , this . unsigned ) ;
340341 }
@@ -343,7 +344,7 @@ export class Long {
343344 * Compares this Long's value with the specified's.
344345 * @returns 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
345346 */
346- compare ( other : string | number | Long ) : 0 | 1 | - 1 {
347+ compare ( other : string | number | Long | Timestamp ) : 0 | 1 | - 1 {
347348 if ( ! Long . isLong ( other ) ) other = Long . fromValue ( other ) ;
348349 if ( this . eq ( other ) ) return 0 ;
349350 const thisNeg = this . isNegative ( ) ,
@@ -366,7 +367,7 @@ export class Long {
366367 * Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned.
367368 * @returns Quotient
368369 */
369- divide ( divisor : string | number | Long ) : Long {
370+ divide ( divisor : string | number | Long | Timestamp ) : Long {
370371 if ( ! Long . isLong ( divisor ) ) divisor = Long . fromValue ( divisor ) ;
371372 if ( divisor . isZero ( ) ) throw Error ( 'division by zero' ) ;
372373
@@ -473,7 +474,7 @@ export class Long {
473474 * Tests if this Long's value equals the specified's.
474475 * @param other - Other value
475476 */
476- equals ( other : string | number | Long ) : boolean {
477+ equals ( other : string | number | Long | Timestamp ) : boolean {
477478 if ( ! Long . isLong ( other ) ) other = Long . fromValue ( other ) ;
478479 if ( this . unsigned !== other . unsigned && this . high >>> 31 === 1 && other . high >>> 31 === 1 )
479480 return false ;
@@ -516,15 +517,15 @@ export class Long {
516517 }
517518
518519 /** Tests if this Long's value is greater than the specified's. */
519- greaterThan ( other : string | number | Long ) : boolean {
520+ greaterThan ( other : string | number | Long | Timestamp ) : boolean {
520521 return this . comp ( other ) > 0 ;
521522 }
522523
523524 /** This is an alias of {@link Long.greaterThan} */
524525 gt = Long . prototype . greaterThan ;
525526
526527 /** Tests if this Long's value is greater than or equal the specified's. */
527- greaterThanOrEqual ( other : string | number | Long ) : boolean {
528+ greaterThanOrEqual ( other : string | number | Long | Timestamp ) : boolean {
528529 return this . comp ( other ) >= 0 ;
529530 }
530531
@@ -559,23 +560,23 @@ export class Long {
559560 }
560561
561562 /** Tests if this Long's value is less than the specified's. */
562- lessThan ( other : string | number | Long ) : boolean {
563+ lessThan ( other : string | number | Long | Timestamp ) : boolean {
563564 return this . comp ( other ) < 0 ;
564565 }
565566
566567 /** This is an alias of {@link Long#lessThan}. */
567568 lt = Long . prototype . lessThan ;
568569
569570 /** Tests if this Long's value is less than or equal the specified's. */
570- lessThanOrEqual ( other : string | number | Long ) : boolean {
571+ lessThanOrEqual ( other : string | number | Long | Timestamp ) : boolean {
571572 return this . comp ( other ) <= 0 ;
572573 }
573574
574575 /** This is an alias of {@link Long.lessThanOrEqual} */
575576 lte = Long . prototype . lessThanOrEqual ;
576577
577578 /** Returns this Long modulo the specified. */
578- modulo ( divisor : string | number | Long ) : Long {
579+ modulo ( divisor : string | number | Long | Timestamp ) : Long {
579580 if ( ! Long . isLong ( divisor ) ) divisor = Long . fromValue ( divisor ) ;
580581
581582 // use wasm support if present
@@ -602,7 +603,7 @@ export class Long {
602603 * @param multiplier - Multiplier
603604 * @returns Product
604605 */
605- multiply ( multiplier : string | number | Long ) : Long {
606+ multiply ( multiplier : string | number | Long | Timestamp ) : Long {
606607 if ( this . isZero ( ) ) return Long . ZERO ;
607608 if ( ! Long . isLong ( multiplier ) ) multiplier = Long . fromValue ( multiplier ) ;
608609
@@ -683,7 +684,7 @@ export class Long {
683684 }
684685
685686 /** Tests if this Long's value differs from the specified's. */
686- notEquals ( other : string | number | Long ) : boolean {
687+ notEquals ( other : string | number | Long | Timestamp ) : boolean {
687688 return ! this . equals ( other ) ;
688689 }
689690
@@ -773,7 +774,7 @@ export class Long {
773774 * @param subtrahend - Subtrahend
774775 * @returns Difference
775776 */
776- subtract ( subtrahend : string | number | Long ) : Long {
777+ subtract ( subtrahend : string | number | Long | Timestamp ) : Long {
777778 if ( ! Long . isLong ( subtrahend ) ) subtrahend = Long . fromValue ( subtrahend ) ;
778779 return this . add ( subtrahend . neg ( ) ) ;
779780 }
0 commit comments