Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit eefe14f

Browse files
committed
make abstract classes abstract
1 parent 3b8880c commit eefe14f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/Layout.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export function uint8ArrayToBuffer(b: Uint8Array): Buffer {
174174
*
175175
* @abstract
176176
*/
177-
export class Layout<T> {
177+
export abstract class Layout<T> {
178178
span: number;
179179
property?: string;
180180
boundConstructor_?: any;
@@ -237,9 +237,7 @@ export class Layout<T> {
237237
*
238238
* @abstract
239239
*/
240-
decode(b: Uint8Array, offset?: number): T {
241-
throw new Error('Layout is abstract');
242-
}
240+
abstract decode(b: Uint8Array, offset?: number): T;
243241

244242
/**
245243
* Encode a JavaScript value into a Uint8Array.
@@ -263,9 +261,7 @@ export class Layout<T> {
263261
*
264262
* @abstract
265263
*/
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;
269265

270266
/**
271267
* Calculate the span of a specific instance of a layout.
@@ -428,7 +424,7 @@ export function bindConstructorLayout<T>(Class: any, layout: Layout<T>): void {
428424
* @abstract
429425
* @augments {Layout}
430426
*/
431-
export class ExternalLayout extends Layout<number> {
427+
export abstract class ExternalLayout extends Layout<number> {
432428
/**
433429
* Return `true` iff the external layout decodes to an unsigned
434430
* integer layout.

0 commit comments

Comments
 (0)