fix: resolve failing tests and type errors across api and shared packages#75
Open
stooit wants to merge 1 commit into
Open
fix: resolve failing tests and type errors across api and shared packages#75stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
…ages - Implement paginate<T> in shared (was a stub throwing 'not implemented') - Fix auth middleware public-method check: 'post' -> 'POST' (HTTP methods are uppercase), so POST /users is correctly public - Align User type field 'userName' -> 'username' for cross-package consistency - Add missing badRequest import in users route handler - Wire already-installed bun-types into tsconfig so bun:test/process resolve
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes all failing tests and TypeScript type errors in the Bun + Hono monorepo. 22/22 tests pass and
tsc --noEmitexits cleanly.Fixes (5 files, source + tsconfig only)
packages/shared/src/utils/pagination.tspaginate<T>(was a stub throwingnot implemented). 1-indexed page slicing via(page-1)*size,totalPages = Math.ceil(total/size), graceful empty-array and out-of-range handling.packages/api/src/middleware/auth.ts"post"but Honoc.req.methodis uppercase, so everyPOSTwrongly required a token. Changed to"POST".packages/shared/src/types.tsUserfielduserName→usernamefor consistency with route handlers and tests.packages/api/src/routes/users.tsbadRequestimport (was a runtimeReferenceErroron invalidPOST /usersbodies).tsconfig.jsonbun-typesintocompilerOptions.typessobun:test/processresolve.strictpreserved.Verification
bun test→ 22 pass, 0 failbunx tsc --noEmit→ exit 0, no errorsConstraints honoured
bun-typeswas already installed; only tsconfig wiring changed).Assumptions
Userfield name isusername(chosen to match the tests, which cannot be modified).