Fix TypeScript 5.9.3 type errors in CI #30
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Recent CI runs were failing with TypeScript 5.9.3 type errors:
TypeScript 5.9.3 introduced stricter type checking for buffer types, specifically distinguishing between
ArrayBufferandArrayBufferLike(which includesSharedArrayBuffer). The Web Crypto API methods require precise buffer types for security reasons.Solution
Updated JSDoc type annotations to be more precise and compatible with the stricter type system:
Changed
secretparameter types fromArrayBuffertoBufferSourceingenerateHOTPandverifyHOTPfunctionsBufferSourceis the correct type for Web Crypto API, accepting bothArrayBufferandArrayBufferViewtypesMade
intToBytesreturn type explicit asUint8Array<ArrayBuffer>Uint8Arraybacked by anArrayBuffer, not aSharedArrayBufferUint8Array<ArrayBufferLike>Removed unnecessary
Uint8Arraywrapper inverifyTOTPbase32Decodealready returns anArrayBufferwhich is now compatible with the updatedBufferSourcetypeVerification
These changes are purely type annotations and don't affect the runtime behavior of the code.
Original prompt
Fixes #29
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Note
Corrects JSDoc types for HOTP functions and removes unnecessary Uint8Array wrapping in TOTP verification.
generateHOTPandverifyHOTPsecretJSDoc types fromArrayBuffertoBufferSource.intToBytesJSDoc return type toUint8Array<ArrayBuffer>.verifyTOTP, passdecodedSecretdirectly toverifyHOTP(removenew Uint8Array(...)wrapper).Written by Cursor Bugbot for commit fb9840d. This will update automatically on new commits. Configure here.