Chore/891 eliminate any usage - #994
Open
abdoolyaro wants to merge 10 commits into
Open
Conversation
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
|
@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! 🚀 |
… 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.
Contributor
|
@abdoolyaro resolve conflicts |
) 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.
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.
closes #891