Migrated claimant.js file to TS#880
Conversation
|
Size Change: -1.28 kB (-0.04%) Total Size: 3.54 MB
|
There was a problem hiding this comment.
Pull request overview
This PR migrates the claimant.js file to TypeScript as part of the ongoing effort to add type safety to the codebase. The migration includes converting the source file, adding proper type annotations, migrating the test file from Mocha/Chai to Vitest, and adding additional test coverage for previously untested code paths.
Changes:
- Converted
src/claimant.tswith proper TypeScript type annotations and JSDoc updates - Migrated test file from
test/unit/claimant_test.jstotest/unit/claimant.test.tsusing Vitest - Added comprehensive test coverage for validation logic in predicateAnd, predicateOr, and predicateNot methods
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
type_validation/claimant.d.ts |
Auto-generated TypeScript declaration file for the Claimant class |
test/unit/claimant_test.js |
Removed old Mocha/Chai test file |
test/unit/claimant.test.ts |
New Vitest-based test file with enhanced coverage |
src/claimant.ts |
Migrated source file with TypeScript types, proper imports with .js extensions, and private properties with underscore prefix |
Comments suppressed due to low confidence (1)
src/claimant.ts:84
- The error message says "right Predicate should be an xdr.ClaimPredicate" but this is misleading since the predicateNot method only has a single predicate parameter, not left and right predicates. The error message should say "Predicate should be an xdr.ClaimPredicate" to be consistent with the constructor's error message and to accurately describe the parameter.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/claimant.ts:22
- In the constructor, destination validation is gated by
destination && ..., so an empty string (or other falsy non-null value) bypasses validation even thoughdestinationis required and later used byKeypair.fromPublicKey, leading to less clear downstream errors. Consider validating unconditionally (and/or explicitly rejecting empty strings) to keep behavior consistent with the docs and other constructors (e.g., Account).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.