Skip to content

Migrated claimant.js file to TS#880

Merged
quietbits merged 3 commits intotypescript-migrationfrom
tsm-claimant
Mar 2, 2026
Merged

Migrated claimant.js file to TS#880
quietbits merged 3 commits intotypescript-migrationfrom
tsm-claimant

Conversation

@quietbits
Copy link
Contributor

No description provided.

@quietbits quietbits linked an issue Feb 27, 2026 that may be closed by this pull request
5 tasks
@github-actions
Copy link

github-actions bot commented Feb 27, 2026

Size Change: -1.28 kB (-0.04%)

Total Size: 3.54 MB

Filename Size Change
dist/stellar-base.js 2.61 MB -1.03 kB (-0.04%)
dist/stellar-base.min.js 928 kB -245 B (-0.03%)

compressed-size-action

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.ts with proper TypeScript type annotations and JSDoc updates
  • Migrated test file from test/unit/claimant_test.js to test/unit/claimant.test.ts using 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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 though destination is required and later used by Keypair.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.

@quietbits quietbits requested a review from Ryang-21 February 27, 2026 15:32
@quietbits quietbits merged commit 624ce90 into typescript-migration Mar 2, 2026
6 checks passed
@quietbits quietbits deleted the tsm-claimant branch March 2, 2026 21:07
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.

Migrate claimant.js file to TS

3 participants