Skip to content

Chore/891 eliminate any usage - #994

Open
abdoolyaro wants to merge 10 commits into
MettaChain:mainfrom
abdoolyaro:chore/891-eliminate-any-usage
Open

Chore/891 eliminate any usage#994
abdoolyaro wants to merge 10 commits into
MettaChain:mainfrom
abdoolyaro:chore/891-eliminate-any-usage

Conversation

@abdoolyaro

Copy link
Copy Markdown
Contributor

closes #891

Replace 8 any annotations with Prisma-derived and explicit types:
- transactionsToActivityItems: TransactionWithPropertyTitle[]
- handleTokenReuse: Prisma.BlacklistedToken
- document/apiKey/passwordHistory map callbacks: Prisma model types
- recaptcha response: new RecaptchaVerifyResponse interface

Part of MettaChain#891
Replace 24 any annotations with Prisma-derived and explicit types:
- create/update DTO fields: Prisma.TransactionType, Prisma.TransactionStatus
- where clauses: Prisma.TransactionWhereInput
- update data: Prisma.TransactionUpdateInput
- blockchain methods: BlockchainTransactionDto, BlockchainVerificationResultDto
- new TransactionWithFullRelations type for createTransaction return
- new UpdateEscrowDto interface
- toResponseDto param: Prisma.Transaction
- removed unnecessary any casts, let TS infer map/filter/reduce callbacks
- tax strategy methods: Prisma.TransactionTaxStrategy

Verified clean with npx tsc --noEmit --skipLibCheck

Part of MettaChain#891
Remove 4 any annotations from map/filter callbacks over Prisma query
results, letting TS infer the correct type from the source array
instead. admin.service.ts already had zero any usages — no change
needed there.

This completes the 4 files named directly in the issue. Verified
clean with npx tsc --noEmit --skipLibCheck.

Part of MettaChain#891
Replace 19 any annotations:
- whereClause params and return types: Prisma.PropertyWhereInput
- individual filter values (price/bedrooms/city/etc): unknown, since
  they're genuinely polymorphic and already narrowed via typeof/
  property checks in each method body
- Record<string, any> in SavedFilter/FilterCombination: Record<string, unknown>
- new SaveFilterDto interface for saveFilter's input shape

Verified clean with npx tsc --noEmit --skipLibCheck

Part of MettaChain#891
Batch of straightforward any removals across interceptors, controllers,
and small services:
- 6 NestJS interceptors: Observable<any> -> Observable<unknown>
- Express Request augmentation for custom properties (apiVersion,
  openAPIDocument) via local extended interfaces instead of casts to any
- Prisma-derived where/update input types (User, TransactionMilestone,
  TransactionNote, VerificationDocument)
- New interfaces for previously-untyped payloads (EmailBouncePayload,
  EmailJobData, CreateDocumentDto wiring)
- redisStore cast in cache.config.ts documented as unavoidable
  third-party interop rather than silently any
- Fixed 2 downstream type errors surfaced by these changes:
  activity-log metadata (object, not string, despite @IsJSON decorator)
  and a spec.ts mock missing required CreateDocumentDto fields

Note: activity-log.controller.ts now correctly types user as
AuthUserPayload, which exposes (but does not fix) a pre-existing bug
where the code reads user.id but the payload only has .sub -- flagging
for a separate issue, out of scope here.

Verified clean with npx tsc --noEmit --skipLibCheck

Part of MettaChain#891
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@abdoolyaro Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

… parse error (MettaChain#891)

The interface was inserted directly between @apitags and @controller,
which is invalid -- a decorator must be immediately followed by the
declaration it decorates. This passed tsc --noEmit (suppressed by
// @ts-nocheck in this file) but failed ESLint parsing with
Decorators are not valid here.
@nanaf6203-bit

Copy link
Copy Markdown
Contributor

@abdoolyaro resolve conflicts

abdoolyaro and others added 3 commits July 26, 2026 20:45
)

PR MettaChain#994's test check failed after merging upstream main, but not from
the any-removal work -- two pre-existing test/implementation gaps got
exposed:

- webhooks.service.spec.ts: create() test still expected a 'not yet
  implemented' throw, but the service has a real implementation
  (generates a secret, writes to DB) merged in from upstream. Rewrote
  the test to assert the real behavior.
- trust-score.service.spec.ts: mockPrismaService was missing a
  verificationDocument mock that calculateBreakdown's new ID-verification
  check (also from an upstream merge) calls. Added the missing mock.

Verified locally: npx jest src/trust-score/trust-score.service.spec.ts
src/webhooks/webhooks.service.spec.ts -> 2 suites, 15 tests, all passing.
EmailService's constructor gained an I18nService parameter (from a
merged i18n feature) but this spec still called it with only 4
positional args, misassigning the queue mock into the i18nService
slot and leaving mailQueue undefined -- caught by nest build's
TS2554 'Expected 5 arguments, but got 4'.

Verified: npx jest src/email/email.service.spec.ts and npx nest build
both pass clean.

Follow-up to the earlier trust-score/webhooks stale-test fix -- same
root cause pattern (upstream merge outpacing tests), unrelated to MettaChain#891.
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.

Eliminate any type usage across the entire codebase

2 participants