@@ -909,7 +909,7 @@ function sizerNumber(type: Type, state: TemplateState) {
909909 state . setContext ( { getValueSize } ) ;
910910 //per default bigint will be serialized as long, to be compatible with default mongo driver and mongo database.
911911 //We should add a new annotation, maybe like `bigint & Binary` to make it binary (unlimited size)
912- sizerPropertyNameAware ( type , state , `( typeof ${ state . accessor } === 'number ' || typeof ${ state . accessor } === 'bigint') && !Number.isNaN(${ state . accessor } )` , `
912+ sizerPropertyNameAware ( type , state , `typeof ${ state . accessor } === 'bigint ' || ( typeof ${ state . accessor } === 'number' && !Number.isNaN(${ state . accessor } ) )` , `
913913 state.size += getValueSize(${ state . accessor } );
914914 ` ) ;
915915}
@@ -986,7 +986,7 @@ function sizerBigInt(type: TypeBigInt, state: TemplateState) {
986986 const bigIntSize = binaryBigInt === BinaryBigIntType . unsigned ? 'getBinaryBigIntSize' : 'getSignedBinaryBigIntSize' ;
987987 //per default bigint will be serialized as long, to be compatible with default mongo driver and mongo database.
988988 //We should add a new annotation, maybe like `bigint & Binary` to make it binary (unlimited size)
989- sizerPropertyNameAware ( type , state , `( typeof ${ state . accessor } === 'number ' || typeof ${ state . accessor } === 'bigint') && !Number.isNaN(${ state . accessor } )` , `
989+ sizerPropertyNameAware ( type , state , `typeof ${ state . accessor } === 'bigint ' || ( typeof ${ state . accessor } === 'number' && !Number.isNaN(${ state . accessor } ) )` , `
990990 state.size += ${ bigIntSize } (${ state . accessor } );
991991 ` ) ;
992992 } else {
@@ -1000,7 +1000,7 @@ function serializeBigInt(type: TypeBigInt, state: TemplateState) {
10001000 if ( binaryBigInt !== undefined ) {
10011001 const writeBigInt = binaryBigInt === BinaryBigIntType . unsigned ? 'writeBigIntBinary' : 'writeSignedBigIntBinary' ;
10021002 state . addCode ( `
1003- if (( 'bigint' === typeof ${ state . accessor } || 'number' === typeof ${ state . accessor } ) && !Number.isNaN(${ state . accessor } )) {
1003+ if ('bigint' === typeof ${ state . accessor } || ( 'number' === typeof ${ state . accessor } ) && !Number.isNaN(${ state . accessor } ) )) {
10041004 //long
10051005 state.writer.writeType(${ BSONType . BINARY } );
10061006 state.writer.${ writeBigInt } (${ state . accessor } );
0 commit comments