1
0
Fork 0

Fix new typescript

This commit is contained in:
Pabloader 2026-05-24 08:32:15 +00:00
parent 135fb6efd1
commit 65660cc639
4 changed files with 12 additions and 7 deletions

View File

@ -21,12 +21,12 @@
"@types/bun": "^1.3.14", "@types/bun": "^1.3.14",
"@types/html-minifier": "4.0.5", "@types/html-minifier": "4.0.5",
"@types/inquirer": "9.0.7", "@types/inquirer": "9.0.7",
"@types/web-bluetooth": "0.0.21", "@types/web-bluetooth": "^0.0.21",
"browser-detect": "0.2.28", "browser-detect": "0.2.28",
"eruda": "3.2.3", "eruda": "3.2.3",
"html-minifier": "4.0.0", "html-minifier": "4.0.0",
"jimp": "1.6.1", "jimp": "1.6.1",
"typescript": "^6.0.3", "typescript": "6.0.3",
"uglify-js": "3.19.3", "uglify-js": "3.19.3",
}, },
}, },

View File

@ -59,7 +59,7 @@ export const NOTIFY_CHARACTERISTIC = "0000ae02-0000-1000-8000-00805f9b34fb";
export const PRINTER_WIDTH = 384; export const PRINTER_WIDTH = 384;
const MTU = PRINTER_WIDTH / 8; 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 len = data.length;
const message = new Uint8Array(len + 8); const message = new Uint8Array(len + 8);
@ -76,11 +76,11 @@ function formatMessage(command: Command, data: number[] | Uint8Array): Uint8Arra
return message; return message;
} }
function formatInt8(command: Command, data: number): Uint8Array { function formatInt8(command: Command, data: number) {
return formatMessage(command, [data & 0xFF]); return formatMessage(command, [data & 0xFF]);
} }
function formatInt16(command: Command, data: number): Uint8Array { function formatInt16(command: Command, data: number) {
const udata = new Uint8Array(2); const udata = new Uint8Array(2);
udata[0] = data & 0xFF; udata[0] = data & 0xFF;
udata[1] = (data >> 8) & 0xFF; udata[1] = (data >> 8) & 0xFF;
@ -153,4 +153,4 @@ export async function testPrint() {
const char = await srv.getCharacteristic(PRINT_CHARACTERISTIC); const char = await srv.getCharacteristic(PRINT_CHARACTERISTIC);
await printBitmap(char, Array(PRINTER_WIDTH * 16).fill(0x55)); await printBitmap(char, Array(PRINTER_WIDTH * 16).fill(0x55));
} }

4
src/types.d.ts vendored
View File

@ -14,6 +14,10 @@ declare module '*.module.css' {
const classes: { [key: string]: string }; const classes: { [key: string]: string };
export default classes; export default classes;
} }
declare module '*.css' {
export default undefined;
}
declare module "*.png" { declare module "*.png" {
const image: HTMLImageElement; const image: HTMLImageElement;
export default image; export default image;

View File

@ -27,7 +27,8 @@
"noPropertyAccessFromIndexSignature": false, "noPropertyAccessFromIndexSignature": false,
"paths": { "paths": {
"@common/*": ["./src/common/*"] "@common/*": ["./src/common/*"]
} },
"types": ["bun", "web-bluetooth"]
}, },
"include": ["./**/*.ts", "./**/*.tsx", "./**/*.js", "./**/*.jsx"], "include": ["./**/*.ts", "./**/*.tsx", "./**/*.js", "./**/*.jsx"],
"exclude": ["./dist/**/*"] "exclude": ["./dist/**/*"]