Skip to content
10 changes: 5 additions & 5 deletions web/src/engine/common/web-utils/src/priority-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export default class PriorityQueue<Type> {
* the first parameter should precede the second parameter.
* @param initialEntries
*/
constructor(comparator: QueueComparator<Type>, initialEntries?: Type[]);
constructor(arg1: QueueComparator<Type> | PriorityQueue<Type>, initialEntries?: Type[]) {
constructor(comparator: QueueComparator<Type>, initialEntries?: ReadonlyArray<Type>);
constructor(arg1: QueueComparator<Type> | PriorityQueue<Type>, initialEntries?: ReadonlyArray<Type>) {
if(typeof arg1 != 'function') {
this.comparator = arg1.comparator;
// Shallow-copies are fine.
Expand Down Expand Up @@ -151,7 +151,7 @@ export default class PriorityQueue<Type> {
* - O(`elements.count` * log(`heap.count`)) - logarithmic when elements.count << heap.count
* @param elements A group of elements to enqueue simultaneously.
*/
enqueueAll(elements: Type[]) {
enqueueAll(elements: ReadonlyArray<Type>) {
if(elements.length == 0) {
return;
}
Expand Down Expand Up @@ -227,7 +227,7 @@ export default class PriorityQueue<Type> {
* This function makes no guarantees on the ordering of the returned elements;
* they will almost certainly be unsorted.
*/
toArray(): Type[] {
return this.heap.slice(0);
toArray(): ReadonlyArray<Type> {
return this.heap;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class ContextState {
const state = new ContextState(applyTransform(trueInput, context), lexicalModel);
state.tokenization = new ContextTokenization(resultTokenization.tokens, tokenizationAnalysis, resultTokenization.taillessTrueKeystroke);
state.appliedInput = transformDistribution?.[0].sample;
transition.finalize(state, transformDistribution, resultTokenization.taillessTrueKeystroke);
transition.finalize(state, transformDistribution);
transition.revertableTransitionId = appliedSuggestionTransitionId;
return transition;
}
Expand Down
Loading