From 65660cc63943f49fbf6b1d0268fe99e060483f29 Mon Sep 17 00:00:00 2001 From: Pabloader Date: Sun, 24 May 2026 08:32:15 +0000 Subject: [PATCH] Fix new typescript --- bun.lock | 4 ++-- src/games/catprinter/printer.ts | 8 ++++---- src/types.d.ts | 4 ++++ tsconfig.json | 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bun.lock b/bun.lock index 504df5f..3673db9 100644 --- a/bun.lock +++ b/bun.lock @@ -21,12 +21,12 @@ "@types/bun": "^1.3.14", "@types/html-minifier": "4.0.5", "@types/inquirer": "9.0.7", - "@types/web-bluetooth": "0.0.21", + "@types/web-bluetooth": "^0.0.21", "browser-detect": "0.2.28", "eruda": "3.2.3", "html-minifier": "4.0.0", "jimp": "1.6.1", - "typescript": "^6.0.3", + "typescript": "6.0.3", "uglify-js": "3.19.3", }, }, diff --git a/src/games/catprinter/printer.ts b/src/games/catprinter/printer.ts index c6e017c..e3a7408 100644 --- a/src/games/catprinter/printer.ts +++ b/src/games/catprinter/printer.ts @@ -59,7 +59,7 @@ export const NOTIFY_CHARACTERISTIC = "0000ae02-0000-1000-8000-00805f9b34fb"; export const PRINTER_WIDTH = 384; const MTU = PRINTER_WIDTH / 8; -function formatMessage(command: Command, data: number[] | Uint8Array): Uint8Array { +function formatMessage(command: Command, data: number[] | Uint8Array) { const len = data.length; const message = new Uint8Array(len + 8); @@ -76,11 +76,11 @@ function formatMessage(command: Command, data: number[] | Uint8Array): Uint8Arra return message; } -function formatInt8(command: Command, data: number): Uint8Array { +function formatInt8(command: Command, data: number) { return formatMessage(command, [data & 0xFF]); } -function formatInt16(command: Command, data: number): Uint8Array { +function formatInt16(command: Command, data: number) { const udata = new Uint8Array(2); udata[0] = data & 0xFF; udata[1] = (data >> 8) & 0xFF; @@ -153,4 +153,4 @@ export async function testPrint() { const char = await srv.getCharacteristic(PRINT_CHARACTERISTIC); await printBitmap(char, Array(PRINTER_WIDTH * 16).fill(0x55)); -} \ No newline at end of file +} diff --git a/src/types.d.ts b/src/types.d.ts index 2e21c9d..8fde3f9 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -14,6 +14,10 @@ declare module '*.module.css' { const classes: { [key: string]: string }; export default classes; } + +declare module '*.css' { + export default undefined; +} declare module "*.png" { const image: HTMLImageElement; export default image; diff --git a/tsconfig.json b/tsconfig.json index d5b07cd..016e447 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,7 +27,8 @@ "noPropertyAccessFromIndexSignature": false, "paths": { "@common/*": ["./src/common/*"] - } + }, + "types": ["bun", "web-bluetooth"] }, "include": ["./**/*.ts", "./**/*.tsx", "./**/*.js", "./**/*.jsx"], "exclude": ["./dist/**/*"]