refactor(authentication,email,database,storage): remove ts-ignore suppressions#1469
Open
it2022031 wants to merge 1 commit into
Open
refactor(authentication,email,database,storage): remove ts-ignore suppressions#1469it2022031 wants to merge 1 commit into
it2022031 wants to merge 1 commit into
Conversation
kkopanidis
requested changes
May 8, 2026
Contributor
kkopanidis
left a comment
There was a problem hiding this comment.
PR contains unrelated changes (metrics). Please focus it to your intentions.
3ab3606 to
e138bb8
Compare
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.
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
The PR fulfills these requirements:
mainbranchfix #xxx, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Other information:
Summary
This PR removes the assigned
@ts-ignore/@ts-expect-errorsuppressions and replaces them with explicit TypeScript-safe handling.Changes
Task A — CRUD validation helpers
File:
modules/database/src/utils/utilities.tsLines: 199–224
Object.keys()returnsstring[], so TypeScript could not safely indexcrudOperations[op]or nested fields. I narrowed the dynamic keys tokeyof CrudOperations/keyof typeof operationConfig, stored the operation config in a typed local variable, and removed the three@ts-ignorecomments.Task B — DB transform /
allowNullFile:
modules/database/src/adapters/utils/database-transform-utils.tsLines: 123–124
objectFieldis typed asIndexable, so TypeScript could not assumeobjectField.requiredwas a boolean. I added an explicitisBoolean(objectField.required)guard and simplified the assignment tores.allowNull = !objectField.required, removing the@ts-expect-error.Task C — Default schema permissions
File:
modules/database/src/adapters/DatabaseAdapter.tsLines: ~472–496
Object.keys(defaultPermissions)returnsstring[], andpermissionsis optional in the schema type. I added a typed helper for assigning default permissions, typed the keys asArray<keyof typeof defaultPermissions>, and removed the@ts-ignore.Task D — Mandrill mail transport
File:
modules/email/src/email-provider/transports/mandrill/MandrilProvider.tsNew file:
modules/email/src/types/nodemailer-mandrill-transport.d.tsnodemailer-mandrill-transportdoes not provide TypeScript declarations. I removed the@ts-expect-errorfrom the import and added a local module declaration file for the package.Task E — Stream → buffer
File:
modules/storage/src/utils/index.tsLines: 16–35
The original implementation used
Buffer.concat(chunks), but this project’s typings reportBufferas incompatible withUint8Array. I typed the stream and chunk input, normalized chunks toBuffer, and used a narrow local cast at theBuffer.concatcall instead of suppressing the error.Task F — Invitation delete
File:
modules/authentication/src/Authentication.tsLines: 679–684
The delete query uses Mongo-style dotted keys (
data.teamId,data.email), which TypeScript cannot treat as normal Token model properties. I extracted the query into anIndexableobject and passed it todeleteOne.Task G — Authentication handlers
Files:
modules/authentication/src/handlers/metamask.tsmodules/authentication/src/handlers/team.tsLines:
metamask.ts: 74, 105, 151team.ts: 137, 583, 650, 688–695Several queries and updates used Mongo-style dotted keys such as
metamask.ethPublicAddress,metamask.nonce,data.email, anddata.teamId. I extracted these into explicitIndexablequery/update objects and removed the suppressions.