mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-05 12:00:59 +08:00
fix(web): resolve TypeScript type error in crypto.ts and add missing test dependencies (#647)
``` src/lib/crypto.ts(66,32): error TS2345: Argument of type 'Uint8Array<ArrayBuffer>' is not assignable to parameter of type 'ArrayBuffer'. ``` `arrayBufferToBase64` function expected `ArrayBuffer` but received `Uint8Array.buffer`. TypeScript strict type checking flagged the mismatch. 1. Update `arrayBufferToBase64` signature to accept `ArrayBuffer | Uint8Array` 2. Pass `result` directly instead of `result.buffer` (more accurate) 3. Add runtime type check with instanceof ``` error TS2307: Cannot find module 'vitest' error TS2307: Cannot find module '@testing-library/react' ``` Install missing devDependencies: - vitest - @testing-library/react - @testing-library/jest-dom ✅ Frontend builds successfully ✅ TypeScript compilation passes ✅ No type errors Related-To: Docker frontend build failures
This commit is contained in:
committed by
GitHub
parent
617f08c9c6
commit
d4f1e6a4d4
@@ -283,8 +283,8 @@ function validatePrivateKeyFormat(key: string): boolean {
|
||||
|
||||
// ==================== 工具函數 ====================
|
||||
|
||||
function arrayBufferToBase64(buffer: ArrayBuffer): string {
|
||||
const bytes = new Uint8Array(buffer);
|
||||
function arrayBufferToBase64(buffer: ArrayBuffer | Uint8Array): string {
|
||||
const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
||||
let binary = '';
|
||||
for (let i = 0; i < bytes.byteLength; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
|
||||
Reference in New Issue
Block a user