Skip to content

Commit

Permalink
tighten types
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudd2 committed Feb 17, 2025
1 parent 8f4e59e commit 6626dbb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/serialport-serialport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export class SerialPortSerialPort extends EventEmitter implements SerialPort {
path: this._path,
};
if (options.dataBits != null)
opts.dataBits = options.dataBits as any;
opts.dataBits = options.dataBits as 5 | 6 | 7 | 8;
if (options.stopBits != null)
opts.stopBits = options.stopBits as any;
opts.stopBits = options.stopBits as 1 | 1.5 | 2;
if (options.parity != null)
opts.parity = options.parity;

Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function isEBB(p: PortInfo): boolean {
async function listEBBs() {
const Binding = autoDetect();
const ports = await Binding.list();
return ports.filter(isEBB).map((p: { path: any; }) => p.path);
return ports.filter(isEBB).map((p: { path: string }) => p.path);
}

export async function waitForEbb (): Promise<Com> {
Expand Down
4 changes: 2 additions & 2 deletions src/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class SaxiDriver implements Driver {

private socket: WebSocket;
private connected: boolean;
private pingInterval: number;
private pingInterval: number | undefined;

public name() {
return 'Saxi Server';
Expand Down Expand Up @@ -312,7 +312,7 @@ class SaxiDriver implements Driver {
this.socket.addEventListener("close", () => {
console.log("Disconnected from EBB server, reconnecting in 5 seconds.");
window.clearInterval(this.pingInterval);
this.pingInterval = null;
this.pingInterval = undefined;
this.connected = false;
if (this.onconnectionchange) { this.onconnectionchange(false); }
this.socket = null;
Expand Down

0 comments on commit 6626dbb

Please sign in to comment.