Skip to content

Commit ec52b93

Browse files
committed
style: some typescript improvements
I wanted to allow @typescript-eslint/no-unsafe-assignment but after the first iteration to much change needed so next time continue
1 parent 0707dae commit ec52b93

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

packages/kboot/src/util/usb/encode-command-option.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export const encodeCommandOption = (option: CommandOption): number[] => {
2525
...pack(payload.length, { bits: 16 }) // payload length in 2 byte
2626
];
2727

28-
const placeholders = new Array(32 - payload.length)
29-
.fill(0);
28+
const placeholders = new Array(32 - payload.length)
29+
.fill(0) as number[];
3030

3131
return [...header, ...payload, ...placeholders];
3232
};

packages/mcumgr/src/serial-peripheral.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class SerialPeripheral implements Peripheral {
7979
const startTime = new Date().getTime();
8080

8181
while (true) {
82-
const response = this.#serialPort.read();
82+
const response = this.#serialPort.read() as Buffer;
8383
logger('Read response: %o', response);
8484
let exit = false;
8585

packages/mcumgr/src/util/cbor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export function decode(data: ArrayBuffer | SharedArrayBuffer, tagger?: Function,
289289
}
290290
}
291291

292-
function decodeItem() {
292+
function decodeItem(): unknown {
293293
const initialByte = readUint8();
294294
const majorType = initialByte >> 5;
295295
const additionalInformation = initialByte & 0x1f;
@@ -366,7 +366,7 @@ export function decode(data: ArrayBuffer | SharedArrayBuffer, tagger?: Function,
366366
case 5: {
367367
const retObject = {};
368368
for (i = 0; i < length || length < 0 && !readBreak(); ++i) {
369-
const key = decodeItem();
369+
const key = decodeItem() as string | number;
370370
retObject[key] = decodeItem();
371371
}
372372
return retObject;

0 commit comments

Comments
 (0)