Skip to content

Commit 87cba0c

Browse files
committed
[bluetooth] Fix types for latest TypeScript compat.
1 parent d2f9734 commit 87cba0c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/cubing/bluetooth/smart-puzzle/gan.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Quaternion } from "three";
44
import { Move } from "../../alg";
5-
import type { KPuzzle, KPatternData } from "../../kpuzzle";
5+
import type { KPatternData, KPuzzle } from "../../kpuzzle";
66
import { KPattern } from "../../kpuzzle";
77
import { puzzles } from "../../puzzles";
88
import {
@@ -164,7 +164,7 @@ const commands: { [cmd: string]: BufferSource } = {
164164
]),
165165
};
166166

167-
function buf2hex(buffer: ArrayBuffer): string {
167+
function buf2hex(buffer: ArrayBufferLike): string {
168168
// buffer is an ArrayBuffer
169169
return (
170170
Array.prototype.map.call(new Uint8Array(buffer), (x: number) =>
@@ -452,7 +452,7 @@ export class GanCube extends BluetoothPuzzle {
452452
await faceletStatus1Characteristic.writeValue(commands.reset);
453453
}
454454

455-
public async readFaceletStatus1Characteristic(): Promise<ArrayBuffer> {
455+
public async readFaceletStatus1Characteristic(): Promise<ArrayBufferLike> {
456456
const faceletStatus1Characteristic =
457457
await this.faceletStatus1Characteristic();
458458
return (await faceletStatus1Characteristic.readValue()).buffer;
@@ -464,7 +464,7 @@ export class GanCube extends BluetoothPuzzle {
464464
return buf2hex((await faceletStatus2Characteristic.readValue()).buffer);
465465
}
466466

467-
public async readActualAngleAndBatteryCharacteristic(): Promise<ArrayBuffer> {
467+
public async readActualAngleAndBatteryCharacteristic(): Promise<ArrayBufferLike> {
468468
const actualAngleAndBatteryCharacteristic =
469469
await this.actualAngleAndBatteryCharacteristic();
470470
return (await actualAngleAndBatteryCharacteristic.readValue()).buffer;

src/cubing/bluetooth/smart-puzzle/gocube.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export class GoCube extends BluetoothPuzzle {
114114
}
115115

116116
private onCubeCharacteristicChanged(event: any): void {
117-
const buffer: DataView = event.target.value;
117+
const buffer: DataView<ArrayBuffer> = event.target.value;
118118
this.recorded.push([event.timeStamp, buf2hex(buffer.buffer)]);
119119
// TODO: read bytes from buffer instead of guessing meaning based on length.
120120
if (buffer.byteLength < 16) {

0 commit comments

Comments
 (0)