From fad3d0e42e14a0b792744c9f93d8718900c3472f Mon Sep 17 00:00:00 2001 From: "arvid.nicolaas" Date: Thu, 1 Jul 2021 20:50:43 +0200 Subject: [PATCH] fix(deno): add proper getters and setters to abstract classes and implement defined abstract methods Apparently Deno is more strict about abstract classes defining properties that are implemented with getters and setters. This caused runtime errors, and has now been fixed. Also, methods that are implemented in an abstract class and then only defined in subclasses do not work, they need an implementation or will cause runtime errors. fix #18 --- .../bimultimap/implementation/immutable.ts | 4 +- deno_dist/hashed/set/immutable.ts | 6 +- deno_dist/list/builder/tree/tree-builder.ts | 159 +++++++++--------- .../list/implementation/leaf/non-empty.ts | 2 +- deno_dist/multiset/implementation/base.ts | 4 +- .../ordered/map/implementation/non-empty.ts | 4 +- .../ordered/set/implementation/non-empty.ts | 4 +- deno_dist/sorted/base.ts | 5 +- deno_dist/table/implementation/base.ts | 4 +- .../src/implementation/immutable.ts | 4 +- packages/hashed/src/set/immutable.ts | 6 +- .../list/src/builder/tree/tree-builder.ts | 159 +++++++++--------- .../list/src/implementation/leaf/non-empty.ts | 2 +- packages/multiset/src/implementation/base.ts | 4 +- .../src/map/implementation/non-empty.ts | 4 +- .../src/set/implementation/non-empty.ts | 4 +- packages/sorted/src/base.ts | 5 +- packages/table/src/implementation/base.ts | 4 +- 18 files changed, 206 insertions(+), 178 deletions(-) diff --git a/deno_dist/bimultimap/implementation/immutable.ts b/deno_dist/bimultimap/implementation/immutable.ts index f60514086..0d732f143 100644 --- a/deno_dist/bimultimap/implementation/immutable.ts +++ b/deno_dist/bimultimap/implementation/immutable.ts @@ -139,7 +139,9 @@ export class BiMultiMapNonEmpty< super(); } - assumeNonEmpty: any; + assumeNonEmpty(): any { + return this; + } asNormal(): any { return this; diff --git a/deno_dist/hashed/set/immutable.ts b/deno_dist/hashed/set/immutable.ts index db14fd39e..5f3bb0359 100644 --- a/deno_dist/hashed/set/immutable.ts +++ b/deno_dist/hashed/set/immutable.ts @@ -10,6 +10,8 @@ export class HashSetEmpty extends CustomBase.EmptyBase implements HashSet { + readonly addAll: any; + constructor(readonly context: HashSetContext) { super(); @@ -24,8 +26,6 @@ export class HashSetEmpty return this.context.emptyBlock().add(value); } - addAll: any; - remove(): this { return this; } @@ -77,7 +77,7 @@ export abstract class HashSetNonEmptyBase extends CustomBase.NonEmptyBase implements HashSet.NonEmpty { - abstract context: HashSetContext; + abstract readonly context: HashSetContext; abstract readonly size: number; abstract stream(): Stream.NonEmpty; abstract forEach( diff --git a/deno_dist/list/builder/tree/tree-builder.ts b/deno_dist/list/builder/tree/tree-builder.ts index 5124ea259..3d27e528b 100644 --- a/deno_dist/list/builder/tree/tree-builder.ts +++ b/deno_dist/list/builder/tree/tree-builder.ts @@ -15,9 +15,12 @@ import { createFromBlock, createNonLeaf } from '../../list-custom.ts'; export abstract class TreeBuilderBase { abstract readonly context: ListContext; abstract readonly level: number; - abstract left: BlockBuilder; - abstract right: BlockBuilder; - abstract middle?: NonLeafBuilder>; + abstract get left(): BlockBuilder; + abstract set left(value: BlockBuilder); + abstract get right(): BlockBuilder; + abstract set right(value: BlockBuilder); + abstract get middle(): NonLeafBuilder> | undefined; + abstract set middle(value: NonLeafBuilder> | undefined); abstract length: number; abstract getChildLength(child: C): number; @@ -64,17 +67,17 @@ export abstract class TreeBuilderBase { } if (undefined !== this.middle) { - const delta = this.middle.modifyFirstChild((firstChild): - | number - | undefined => { - if (firstChild.nrChildren < this.context.maxBlockSize) { - const shiftChild = this.left.dropLast(); - this.left.prepend(child); - firstChild.prepend(shiftChild); - return this.getChildLength(shiftChild); + const delta = this.middle.modifyFirstChild( + (firstChild): number | undefined => { + if (firstChild.nrChildren < this.context.maxBlockSize) { + const shiftChild = this.left.dropLast(); + this.left.prepend(child); + firstChild.prepend(shiftChild); + return this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return; } else if (this.right.nrChildren < this.context.maxBlockSize) { @@ -100,17 +103,17 @@ export abstract class TreeBuilderBase { if (undefined !== this.middle) { // try to shift to last middle child - const delta = this.middle.modifyLastChild((lastChild): - | number - | undefined => { - if (lastChild.nrChildren < this.context.maxBlockSize) { - const shiftChild = this.right.dropFirst(); - this.right.append(child); - lastChild.append(shiftChild); - return this.getChildLength(shiftChild); + const delta = this.middle.modifyLastChild( + (lastChild): number | undefined => { + if (lastChild.nrChildren < this.context.maxBlockSize) { + const shiftChild = this.right.dropFirst(); + this.right.append(child); + lastChild.append(shiftChild); + return this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return; } else if (this.left.nrChildren < this.context.maxBlockSize) { @@ -142,17 +145,17 @@ export abstract class TreeBuilderBase { if (undefined !== this.middle) { // left borrows from middle - const delta = this.middle.modifyFirstChild((firstChild): - | number - | undefined => { - if (firstChild.nrChildren > this.context.minBlockSize) { - // left borrows from middle's first grandChild - const shiftChild = firstChild.dropFirst(); - this.left.append(shiftChild); - return -this.getChildLength(shiftChild); + const delta = this.middle.modifyFirstChild( + (firstChild): number | undefined => { + if (firstChild.nrChildren > this.context.minBlockSize) { + // left borrows from middle's first grandChild + const shiftChild = firstChild.dropFirst(); + this.left.append(shiftChild); + return -this.getChildLength(shiftChild); + } + return; } - return; - }); + ); // if borrow was succesful if (undefined !== delta) return oldValue; @@ -181,16 +184,16 @@ export abstract class TreeBuilderBase { if (undefined !== this.middle) { // right borrows from middle - const delta = this.middle.modifyLastChild((lastChild): - | number - | undefined => { - if (lastChild.nrChildren > this.context.minBlockSize) { - const shiftChild = lastChild.dropLast(); - this.right.prepend(shiftChild); - return -this.getChildLength(shiftChild); + const delta = this.middle.modifyLastChild( + (lastChild): number | undefined => { + if (lastChild.nrChildren > this.context.minBlockSize) { + const shiftChild = lastChild.dropLast(); + this.right.prepend(shiftChild); + return -this.getChildLength(shiftChild); + } + return; } - return; - }); + ); // if borrow was succesful if (undefined !== delta) return oldValue; @@ -227,16 +230,16 @@ export abstract class TreeBuilderBase { if (undefined !== this.middle) { // try shift to middle - const delta = this.middle.modifyFirstChild((firstChild): - | number - | undefined => { - if (firstChild.nrChildren < this.context.maxBlockSize) { - const shiftChild = this.left.dropLast(); - firstChild.prepend(shiftChild); - return this.getChildLength(shiftChild); + const delta = this.middle.modifyFirstChild( + (firstChild): number | undefined => { + if (firstChild.nrChildren < this.context.maxBlockSize) { + const shiftChild = this.left.dropLast(); + firstChild.prepend(shiftChild); + return this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return; } else if (this.right.nrChildren < this.context.maxBlockSize) { @@ -261,16 +264,16 @@ export abstract class TreeBuilderBase { if (undefined !== this.middle) { // try to shift child to middle last - const delta = this.middle.modifyLastChild((lastChild): - | number - | undefined => { - if (lastChild.nrChildren < this.context.maxBlockSize) { - const shiftChild = this.right.dropFirst(); - lastChild.append(shiftChild); - return this.getChildLength(shiftChild); + const delta = this.middle.modifyLastChild( + (lastChild): number | undefined => { + if (lastChild.nrChildren < this.context.maxBlockSize) { + const shiftChild = this.right.dropFirst(); + lastChild.append(shiftChild); + return this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return; } else if (this.left.nrChildren < this.context.maxBlockSize) { @@ -374,16 +377,16 @@ export abstract class TreeBuilderBase { if (this.left.nrChildren >= this.context.minBlockSize) return first; if (undefined !== this.middle) { - const delta = this.middle.modifyFirstChild((firstChild): - | number - | undefined => { - if (firstChild.nrChildren > this.context.minBlockSize) { - const shiftChild = firstChild.dropFirst(); - this.left.append(shiftChild); - return -this.getChildLength(shiftChild); + const delta = this.middle.modifyFirstChild( + (firstChild): number | undefined => { + if (firstChild.nrChildren > this.context.minBlockSize) { + const shiftChild = firstChild.dropFirst(); + this.left.append(shiftChild); + return -this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return first; @@ -409,16 +412,16 @@ export abstract class TreeBuilderBase { if (this.right.nrChildren >= this.context.minBlockSize) return last; if (undefined !== this.middle) { - const delta = this.middle.modifyLastChild((lastChild): - | number - | undefined => { - if (lastChild.nrChildren > this.context.minBlockSize) { - const shiftChild = lastChild.dropLast(); - this.right.prepend(shiftChild); - return -this.getChildLength(shiftChild); + const delta = this.middle.modifyLastChild( + (lastChild): number | undefined => { + if (lastChild.nrChildren > this.context.minBlockSize) { + const shiftChild = lastChild.dropLast(); + this.right.prepend(shiftChild); + return -this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return last; diff --git a/deno_dist/list/implementation/leaf/non-empty.ts b/deno_dist/list/implementation/leaf/non-empty.ts index 2696e453b..a562d0360 100644 --- a/deno_dist/list/implementation/leaf/non-empty.ts +++ b/deno_dist/list/implementation/leaf/non-empty.ts @@ -29,7 +29,7 @@ export abstract class ListNonEmptyBase extends CustomBase.NonEmptyBase implements List.NonEmpty { - abstract context: ListContext; + abstract readonly context: ListContext; abstract readonly length: number; abstract stream(reversed?: boolean): Stream.NonEmpty; abstract streamRange(range: IndexRange, reversed?: boolean): Stream; diff --git a/deno_dist/multiset/implementation/base.ts b/deno_dist/multiset/implementation/base.ts index af174f0e3..5ac7a9567 100644 --- a/deno_dist/multiset/implementation/base.ts +++ b/deno_dist/multiset/implementation/base.ts @@ -130,7 +130,9 @@ export class MultiSetNonEmpty< super(); } - assumeNonEmpty: any; + assumeNonEmpty(): any { + return this; + } asNormal(): any { return this; diff --git a/deno_dist/ordered/map/implementation/non-empty.ts b/deno_dist/ordered/map/implementation/non-empty.ts index bc37dddfb..7572b9c25 100644 --- a/deno_dist/ordered/map/implementation/non-empty.ts +++ b/deno_dist/ordered/map/implementation/non-empty.ts @@ -58,7 +58,9 @@ export class OrderedMapNonEmpty< return this; } - assumeNonEmpty: any; + assumeNonEmpty(): any { + return this; + } stream(): Stream.NonEmpty<[K, V]> { return this.streamKeys().map((k): [K, V] => [ diff --git a/deno_dist/ordered/set/implementation/non-empty.ts b/deno_dist/ordered/set/implementation/non-empty.ts index bee1ecaeb..0df21d797 100644 --- a/deno_dist/ordered/set/implementation/non-empty.ts +++ b/deno_dist/ordered/set/implementation/non-empty.ts @@ -28,7 +28,9 @@ export class OrderedSetNonEmpty< return this; } - assumeNonEmpty: any; + assumeNonEmpty(): any { + return this; + } copy(order = this.order, sourceSet = this.sourceSet): TpG['nonEmpty'] { return this.context.createNonEmpty(order, sourceSet as any); diff --git a/deno_dist/sorted/base.ts b/deno_dist/sorted/base.ts index 061b4d9a4..8d569dfb1 100644 --- a/deno_dist/sorted/base.ts +++ b/deno_dist/sorted/base.ts @@ -37,7 +37,7 @@ export abstract class SortedNonEmptyBase< abstract getAtIndex(index: number, otherwise?: OptLazy): E | O; // internal - abstract entries: readonly E[]; + abstract readonly entries: readonly E[]; abstract takeInternal(amount: number): TS; abstract dropInternal(amount: number): TS; @@ -663,7 +663,8 @@ export abstract class SortedBuilder { }; abstract _entries?: E[]; abstract _children?: SortedBuilder[]; - abstract children: SortedBuilder[]; + abstract get children(): SortedBuilder[]; + abstract set children(value: SortedBuilder[]); abstract size: number; abstract prepareMutate(): void; abstract createNew( diff --git a/deno_dist/table/implementation/base.ts b/deno_dist/table/implementation/base.ts index c2717dfa2..53f302fb8 100644 --- a/deno_dist/table/implementation/base.ts +++ b/deno_dist/table/implementation/base.ts @@ -170,7 +170,9 @@ export class TableNonEmpty< super(); } - assumeNonEmpty: any; + assumeNonEmpty(): any { + return this; + } asNormal(): any { return this; diff --git a/packages/bimultimap/src/implementation/immutable.ts b/packages/bimultimap/src/implementation/immutable.ts index c281419d8..efa71badd 100644 --- a/packages/bimultimap/src/implementation/immutable.ts +++ b/packages/bimultimap/src/implementation/immutable.ts @@ -139,7 +139,9 @@ export class BiMultiMapNonEmpty< super(); } - assumeNonEmpty: any; + assumeNonEmpty(): any { + return this; + } asNormal(): any { return this; diff --git a/packages/hashed/src/set/immutable.ts b/packages/hashed/src/set/immutable.ts index 22254bc6c..b3c16e411 100644 --- a/packages/hashed/src/set/immutable.ts +++ b/packages/hashed/src/set/immutable.ts @@ -10,6 +10,8 @@ export class HashSetEmpty extends CustomBase.EmptyBase implements HashSet { + readonly addAll: any; + constructor(readonly context: HashSetContext) { super(); @@ -24,8 +26,6 @@ export class HashSetEmpty return this.context.emptyBlock().add(value); } - addAll: any; - remove(): this { return this; } @@ -77,7 +77,7 @@ export abstract class HashSetNonEmptyBase extends CustomBase.NonEmptyBase implements HashSet.NonEmpty { - abstract context: HashSetContext; + abstract readonly context: HashSetContext; abstract readonly size: number; abstract stream(): Stream.NonEmpty; abstract forEach( diff --git a/packages/list/src/builder/tree/tree-builder.ts b/packages/list/src/builder/tree/tree-builder.ts index fcacc1f8c..a68078037 100644 --- a/packages/list/src/builder/tree/tree-builder.ts +++ b/packages/list/src/builder/tree/tree-builder.ts @@ -15,9 +15,12 @@ import { createFromBlock, createNonLeaf } from '../../list-custom'; export abstract class TreeBuilderBase { abstract readonly context: ListContext; abstract readonly level: number; - abstract left: BlockBuilder; - abstract right: BlockBuilder; - abstract middle?: NonLeafBuilder>; + abstract get left(): BlockBuilder; + abstract set left(value: BlockBuilder); + abstract get right(): BlockBuilder; + abstract set right(value: BlockBuilder); + abstract get middle(): NonLeafBuilder> | undefined; + abstract set middle(value: NonLeafBuilder> | undefined); abstract length: number; abstract getChildLength(child: C): number; @@ -64,17 +67,17 @@ export abstract class TreeBuilderBase { } if (undefined !== this.middle) { - const delta = this.middle.modifyFirstChild((firstChild): - | number - | undefined => { - if (firstChild.nrChildren < this.context.maxBlockSize) { - const shiftChild = this.left.dropLast(); - this.left.prepend(child); - firstChild.prepend(shiftChild); - return this.getChildLength(shiftChild); + const delta = this.middle.modifyFirstChild( + (firstChild): number | undefined => { + if (firstChild.nrChildren < this.context.maxBlockSize) { + const shiftChild = this.left.dropLast(); + this.left.prepend(child); + firstChild.prepend(shiftChild); + return this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return; } else if (this.right.nrChildren < this.context.maxBlockSize) { @@ -100,17 +103,17 @@ export abstract class TreeBuilderBase { if (undefined !== this.middle) { // try to shift to last middle child - const delta = this.middle.modifyLastChild((lastChild): - | number - | undefined => { - if (lastChild.nrChildren < this.context.maxBlockSize) { - const shiftChild = this.right.dropFirst(); - this.right.append(child); - lastChild.append(shiftChild); - return this.getChildLength(shiftChild); + const delta = this.middle.modifyLastChild( + (lastChild): number | undefined => { + if (lastChild.nrChildren < this.context.maxBlockSize) { + const shiftChild = this.right.dropFirst(); + this.right.append(child); + lastChild.append(shiftChild); + return this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return; } else if (this.left.nrChildren < this.context.maxBlockSize) { @@ -142,17 +145,17 @@ export abstract class TreeBuilderBase { if (undefined !== this.middle) { // left borrows from middle - const delta = this.middle.modifyFirstChild((firstChild): - | number - | undefined => { - if (firstChild.nrChildren > this.context.minBlockSize) { - // left borrows from middle's first grandChild - const shiftChild = firstChild.dropFirst(); - this.left.append(shiftChild); - return -this.getChildLength(shiftChild); + const delta = this.middle.modifyFirstChild( + (firstChild): number | undefined => { + if (firstChild.nrChildren > this.context.minBlockSize) { + // left borrows from middle's first grandChild + const shiftChild = firstChild.dropFirst(); + this.left.append(shiftChild); + return -this.getChildLength(shiftChild); + } + return; } - return; - }); + ); // if borrow was succesful if (undefined !== delta) return oldValue; @@ -181,16 +184,16 @@ export abstract class TreeBuilderBase { if (undefined !== this.middle) { // right borrows from middle - const delta = this.middle.modifyLastChild((lastChild): - | number - | undefined => { - if (lastChild.nrChildren > this.context.minBlockSize) { - const shiftChild = lastChild.dropLast(); - this.right.prepend(shiftChild); - return -this.getChildLength(shiftChild); + const delta = this.middle.modifyLastChild( + (lastChild): number | undefined => { + if (lastChild.nrChildren > this.context.minBlockSize) { + const shiftChild = lastChild.dropLast(); + this.right.prepend(shiftChild); + return -this.getChildLength(shiftChild); + } + return; } - return; - }); + ); // if borrow was succesful if (undefined !== delta) return oldValue; @@ -227,16 +230,16 @@ export abstract class TreeBuilderBase { if (undefined !== this.middle) { // try shift to middle - const delta = this.middle.modifyFirstChild((firstChild): - | number - | undefined => { - if (firstChild.nrChildren < this.context.maxBlockSize) { - const shiftChild = this.left.dropLast(); - firstChild.prepend(shiftChild); - return this.getChildLength(shiftChild); + const delta = this.middle.modifyFirstChild( + (firstChild): number | undefined => { + if (firstChild.nrChildren < this.context.maxBlockSize) { + const shiftChild = this.left.dropLast(); + firstChild.prepend(shiftChild); + return this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return; } else if (this.right.nrChildren < this.context.maxBlockSize) { @@ -261,16 +264,16 @@ export abstract class TreeBuilderBase { if (undefined !== this.middle) { // try to shift child to middle last - const delta = this.middle.modifyLastChild((lastChild): - | number - | undefined => { - if (lastChild.nrChildren < this.context.maxBlockSize) { - const shiftChild = this.right.dropFirst(); - lastChild.append(shiftChild); - return this.getChildLength(shiftChild); + const delta = this.middle.modifyLastChild( + (lastChild): number | undefined => { + if (lastChild.nrChildren < this.context.maxBlockSize) { + const shiftChild = this.right.dropFirst(); + lastChild.append(shiftChild); + return this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return; } else if (this.left.nrChildren < this.context.maxBlockSize) { @@ -374,16 +377,16 @@ export abstract class TreeBuilderBase { if (this.left.nrChildren >= this.context.minBlockSize) return first; if (undefined !== this.middle) { - const delta = this.middle.modifyFirstChild((firstChild): - | number - | undefined => { - if (firstChild.nrChildren > this.context.minBlockSize) { - const shiftChild = firstChild.dropFirst(); - this.left.append(shiftChild); - return -this.getChildLength(shiftChild); + const delta = this.middle.modifyFirstChild( + (firstChild): number | undefined => { + if (firstChild.nrChildren > this.context.minBlockSize) { + const shiftChild = firstChild.dropFirst(); + this.left.append(shiftChild); + return -this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return first; @@ -409,16 +412,16 @@ export abstract class TreeBuilderBase { if (this.right.nrChildren >= this.context.minBlockSize) return last; if (undefined !== this.middle) { - const delta = this.middle.modifyLastChild((lastChild): - | number - | undefined => { - if (lastChild.nrChildren > this.context.minBlockSize) { - const shiftChild = lastChild.dropLast(); - this.right.prepend(shiftChild); - return -this.getChildLength(shiftChild); + const delta = this.middle.modifyLastChild( + (lastChild): number | undefined => { + if (lastChild.nrChildren > this.context.minBlockSize) { + const shiftChild = lastChild.dropLast(); + this.right.prepend(shiftChild); + return -this.getChildLength(shiftChild); + } + return; } - return; - }); + ); if (undefined !== delta) return last; diff --git a/packages/list/src/implementation/leaf/non-empty.ts b/packages/list/src/implementation/leaf/non-empty.ts index 521d400d9..472c837c2 100644 --- a/packages/list/src/implementation/leaf/non-empty.ts +++ b/packages/list/src/implementation/leaf/non-empty.ts @@ -29,7 +29,7 @@ export abstract class ListNonEmptyBase extends CustomBase.NonEmptyBase implements List.NonEmpty { - abstract context: ListContext; + abstract readonly context: ListContext; abstract readonly length: number; abstract stream(reversed?: boolean): Stream.NonEmpty; abstract streamRange(range: IndexRange, reversed?: boolean): Stream; diff --git a/packages/multiset/src/implementation/base.ts b/packages/multiset/src/implementation/base.ts index 19ea059b3..293896043 100644 --- a/packages/multiset/src/implementation/base.ts +++ b/packages/multiset/src/implementation/base.ts @@ -130,7 +130,9 @@ export class MultiSetNonEmpty< super(); } - assumeNonEmpty: any; + assumeNonEmpty(): any { + return this; + } asNormal(): any { return this; diff --git a/packages/ordered/src/map/implementation/non-empty.ts b/packages/ordered/src/map/implementation/non-empty.ts index 8deab3fcf..ff9a39a61 100644 --- a/packages/ordered/src/map/implementation/non-empty.ts +++ b/packages/ordered/src/map/implementation/non-empty.ts @@ -58,7 +58,9 @@ export class OrderedMapNonEmpty< return this; } - assumeNonEmpty: any; + assumeNonEmpty(): any { + return this; + } stream(): Stream.NonEmpty<[K, V]> { return this.streamKeys().map((k): [K, V] => [ diff --git a/packages/ordered/src/set/implementation/non-empty.ts b/packages/ordered/src/set/implementation/non-empty.ts index 517a22d4d..b5c4ef8cf 100644 --- a/packages/ordered/src/set/implementation/non-empty.ts +++ b/packages/ordered/src/set/implementation/non-empty.ts @@ -28,7 +28,9 @@ export class OrderedSetNonEmpty< return this; } - assumeNonEmpty: any; + assumeNonEmpty(): any { + return this; + } copy(order = this.order, sourceSet = this.sourceSet): TpG['nonEmpty'] { return this.context.createNonEmpty(order, sourceSet as any); diff --git a/packages/sorted/src/base.ts b/packages/sorted/src/base.ts index c560b3dd5..6a01dac8b 100644 --- a/packages/sorted/src/base.ts +++ b/packages/sorted/src/base.ts @@ -37,7 +37,7 @@ export abstract class SortedNonEmptyBase< abstract getAtIndex(index: number, otherwise?: OptLazy): E | O; // internal - abstract entries: readonly E[]; + abstract readonly entries: readonly E[]; abstract takeInternal(amount: number): TS; abstract dropInternal(amount: number): TS; @@ -663,7 +663,8 @@ export abstract class SortedBuilder { }; abstract _entries?: E[]; abstract _children?: SortedBuilder[]; - abstract children: SortedBuilder[]; + abstract get children(): SortedBuilder[]; + abstract set children(value: SortedBuilder[]); abstract size: number; abstract prepareMutate(): void; abstract createNew( diff --git a/packages/table/src/implementation/base.ts b/packages/table/src/implementation/base.ts index f05e9ad8d..5af8c4fc5 100644 --- a/packages/table/src/implementation/base.ts +++ b/packages/table/src/implementation/base.ts @@ -170,7 +170,9 @@ export class TableNonEmpty< super(); } - assumeNonEmpty: any; + assumeNonEmpty(): any { + return this; + } asNormal(): any { return this;