This repository was archived by the owner on Jan 13, 2025. It is now read-only.
File tree 1 file changed +4
-8
lines changed
1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ export function uint8ArrayToBuffer(b: Uint8Array): Buffer {
174
174
*
175
175
* @abstract
176
176
*/
177
- export class Layout < T > {
177
+ export abstract class Layout < T > {
178
178
span : number ;
179
179
property ?: string ;
180
180
boundConstructor_ ?: any ;
@@ -237,9 +237,7 @@ export class Layout<T> {
237
237
*
238
238
* @abstract
239
239
*/
240
- decode ( b : Uint8Array , offset ?: number ) : T {
241
- throw new Error ( 'Layout is abstract' ) ;
242
- }
240
+ abstract decode ( b : Uint8Array , offset ?: number ) : T ;
243
241
244
242
/**
245
243
* Encode a JavaScript value into a Uint8Array.
@@ -263,9 +261,7 @@ export class Layout<T> {
263
261
*
264
262
* @abstract
265
263
*/
266
- encode ( src : T , b : Uint8Array , offset ?: number ) : number {
267
- throw new Error ( 'Layout is abstract' ) ;
268
- }
264
+ abstract encode ( src : T , b : Uint8Array , offset ?: number ) : number ;
269
265
270
266
/**
271
267
* Calculate the span of a specific instance of a layout.
@@ -428,7 +424,7 @@ export function bindConstructorLayout<T>(Class: any, layout: Layout<T>): void {
428
424
* @abstract
429
425
* @augments {Layout }
430
426
*/
431
- export class ExternalLayout extends Layout < number > {
427
+ export abstract class ExternalLayout extends Layout < number > {
432
428
/**
433
429
* Return `true` iff the external layout decodes to an unsigned
434
430
* integer layout.
You can’t perform that action at this time.
0 commit comments