@@ -96,7 +96,7 @@ export class Decoder<ContextType = undefined> {
9696 }
9797
9898 private appendBuffer ( buffer : ArrayLike < number > | BufferSource ) {
99- if ( this . headByte === HEAD_BYTE_REQUIRED && ! this . hasRemaining ( ) ) {
99+ if ( this . headByte === HEAD_BYTE_REQUIRED && ! this . hasRemaining ( 1 ) ) {
100100 this . setBuffer ( buffer ) ;
101101 } else {
102102 const remainingData = this . bytes . subarray ( this . pos ) ;
@@ -110,7 +110,7 @@ export class Decoder<ContextType = undefined> {
110110 }
111111 }
112112
113- private hasRemaining ( size = 1 ) {
113+ private hasRemaining ( size : number ) {
114114 return this . view . byteLength - this . pos >= size ;
115115 }
116116
@@ -128,7 +128,7 @@ export class Decoder<ContextType = undefined> {
128128 this . setBuffer ( buffer ) ;
129129
130130 const object = this . doDecodeSync ( ) ;
131- if ( this . hasRemaining ( ) ) {
131+ if ( this . hasRemaining ( 1 ) ) {
132132 throw this . createExtraByteError ( this . pos ) ;
133133 }
134134 return object ;
@@ -138,7 +138,7 @@ export class Decoder<ContextType = undefined> {
138138 this . reinitializeState ( ) ;
139139 this . setBuffer ( buffer ) ;
140140
141- while ( this . hasRemaining ( ) ) {
141+ while ( this . hasRemaining ( 1 ) ) {
142142 yield this . doDecodeSync ( ) ;
143143 }
144144 }
@@ -166,7 +166,7 @@ export class Decoder<ContextType = undefined> {
166166 }
167167
168168 if ( decoded ) {
169- if ( this . hasRemaining ( ) ) {
169+ if ( this . hasRemaining ( 1 ) ) {
170170 throw this . createExtraByteError ( this . totalPos ) ;
171171 }
172172 return object ;
0 commit comments