Skip to content

refactor(authentication,email,database,storage): remove ts-ignore suppressions#1469

Open
it2022031 wants to merge 1 commit into
mainfrom
fix/typescript-ignore-cleanup
Open

refactor(authentication,email,database,storage): remove ts-ignore suppressions#1469
it2022031 wants to merge 1 commit into
mainfrom
fix/typescript-ignore-cleanup

Conversation

@it2022031
Copy link
Copy Markdown

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other (please describe)

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the main branch
  • When resolving a specific issue, it's referenced in the PR's description (e.g. fix #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-error suppressions and replaces them with explicit TypeScript-safe handling.

Changes

Task A — CRUD validation helpers

File: modules/database/src/utils/utilities.ts
Lines: 199–224

Object.keys() returns string[], so TypeScript could not safely index crudOperations[op] or nested fields. I narrowed the dynamic keys to keyof CrudOperations / keyof typeof operationConfig, stored the operation config in a typed local variable, and removed the three @ts-ignore comments.

Task B — DB transform / allowNull

File: modules/database/src/adapters/utils/database-transform-utils.ts
Lines: 123–124

objectField is typed as Indexable, so TypeScript could not assume objectField.required was a boolean. I added an explicit isBoolean(objectField.required) guard and simplified the assignment to res.allowNull = !objectField.required, removing the @ts-expect-error.

Task C — Default schema permissions

File: modules/database/src/adapters/DatabaseAdapter.ts
Lines: ~472–496

Object.keys(defaultPermissions) returns string[], and permissions is optional in the schema type. I added a typed helper for assigning default permissions, typed the keys as Array<keyof typeof defaultPermissions>, and removed the @ts-ignore.

Task D — Mandrill mail transport

File: modules/email/src/email-provider/transports/mandrill/MandrilProvider.ts
New file: modules/email/src/types/nodemailer-mandrill-transport.d.ts

nodemailer-mandrill-transport does not provide TypeScript declarations. I removed the @ts-expect-error from the import and added a local module declaration file for the package.

Task E — Stream → buffer

File: modules/storage/src/utils/index.ts
Lines: 16–35

The original implementation used Buffer.concat(chunks), but this project’s typings report Buffer as incompatible with Uint8Array. I typed the stream and chunk input, normalized chunks to Buffer, and used a narrow local cast at the Buffer.concat call instead of suppressing the error.

Task F — Invitation delete

File: modules/authentication/src/Authentication.ts
Lines: 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 an Indexable object and passed it to deleteOne.

Task G — Authentication handlers

Files:
modules/authentication/src/handlers/metamask.ts
modules/authentication/src/handlers/team.ts

Lines:
metamask.ts: 74, 105, 151
team.ts: 137, 583, 650, 688–695

Several queries and updates used Mongo-style dotted keys such as metamask.ethPublicAddress, metamask.nonce, data.email, and data.teamId. I extracted these into explicit Indexable query/update objects and removed the suppressions.

@it2022031 it2022031 changed the title Fix/typescript ignore cleanup refactor(authentication,email,database,storage): remove ts-ignore suppressions May 7, 2026
Copy link
Copy Markdown
Contributor

@kkopanidis kkopanidis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR contains unrelated changes (metrics). Please focus it to your intentions.

@it2022031 it2022031 force-pushed the fix/typescript-ignore-cleanup branch from 3ab3606 to e138bb8 Compare May 11, 2026 11:25
@it2022031 it2022031 requested a review from kkopanidis May 11, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants