Skip to content

Fix LSP types, lints in Python and Typescript tests#1571

Merged
benalleng merged 1 commit into
payjoin:masterfrom
xstoicunicornx:fix-py-ts-test-types
May 21, 2026
Merged

Fix LSP types, lints in Python and Typescript tests#1571
benalleng merged 1 commit into
payjoin:masterfrom
xstoicunicornx:fix-py-ts-test-types

Conversation

@xstoicunicornx

@xstoicunicornx xstoicunicornx commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

There were a bunch of innocuous type/linting errors/warnings in the javascript and python bindings tests that can be distracting during active development. This change cleans these up.

AI Disclosure

Claude AI was used resolve some of these errors and to apply changes from treefmt linting CI errors that were produced when initially pushing this branch.

Please confirm the following before requesting review:

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 26234911526

Coverage remained the same at 85.14%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 13701
Covered Lines: 11665
Line Coverage: 85.14%
Coverage Strength: 394.85 hits per line

💛 - Coveralls

@benalleng benalleng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

CACK though I do have a question about the PJ helper

I am a little confused about what env you see these errors in as I do not see any errors using the dev env on master, could you share your lint errors or the linter version you see them with?

Comment on lines +37 to +45
// Helper types to avoid repeating InstanceType<PayjoinModule[...]> everywhere.
type PJ<K extends keyof PayjoinModule> = InstanceType<
PayjoinModule[K] & (new (...args: any) => any)
>;
type PJNested<
K extends keyof PayjoinModule,
N extends keyof PayjoinModule[K],
> = InstanceType<PayjoinModule[K][N] & (new (...args: any) => any)>;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Was this causing lint errors or just a readability enhancement you decided to make?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It was causing LSP errors. For example this return type:

InstanceType<PayjoinModule["Initialized"]>

was triggering this error:

error 2344| Type 'typeof Initialized' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type.

@xstoicunicornx

Copy link
Copy Markdown
Collaborator Author

Mostly errors in my lsp using typescript-languange-server.

Here is a dump of the errors I was seeing (sorry about the formatting) payjoin-ffi/javascript/test/integration.test.ts|157 col 17-45 error 2344| Type 'typeof Initialized' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|165 col 25-47 error 2344| Type 'typeof PjUri' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|203 col 13-22 error 2322| Type 'Uint8Array' is not assignable to type 'ArrayBuffer'. Types of property '[Symbol.toStringTag]' are incompatible. Type '"Uint8Array"' is not assignable to type '"ArrayBuffer"'. payjoin-ffi/javascript/test/integration.test.ts|209 col 13-25 error 2322| Type 'Buffer' is not assignable to type 'ArrayBuffer'. Types of property '[Symbol.toStringTag]' are incompatible. Type '"Uint8Array"' is not assignable to type '"ArrayBuffer"'. payjoin-ffi/javascript/test/integration.test.ts|222 col 5-12 note 6133| 'payjoin' is declared but its value is never read. payjoin-ffi/javascript/test/integration.test.ts|223 col 28-64 error 2344| Type 'typeof ProvisionalProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|226 col 25-57 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|234 col 28-58 error 2344| Type 'typeof WantsFeeRange' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|237 col 25-57 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|249 col 28-56 error 2344| Type 'typeof WantsInputs' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|252 col 25-57 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|267 col 28-57 error 2344| Type 'typeof WantsOutputs' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|270 col 25-57 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|282 col 28-59 error 2344| Type 'typeof OutputsUnknown' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|285 col 25-57 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|299 col 28-60 error 2344| Type 'typeof MaybeInputsSeen' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|302 col 25-57 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|316 col 28-61 error 2344| Type 'typeof MaybeInputsOwned' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|319 col 25-57 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|333 col 28-69 error 2344| Type 'typeof UncheckedOriginalPayload' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|336 col 25-57 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|353 col 28-56 error 2344| Type 'typeof Initialized' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|357 col 25-57 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|387 col 24-52 error 2344| Type 'typeof Initialized' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|388 col 24-65 error 2344| Type 'typeof UncheckedOriginalPayload' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|389 col 24-57 error 2344| Type 'typeof MaybeInputsOwned' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|390 col 24-56 error 2344| Type 'typeof MaybeInputsSeen' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|391 col 24-55 error 2344| Type 'typeof OutputsUnknown' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|392 col 24-53 error 2344| Type 'typeof WantsOutputs' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|393 col 24-52 error 2344| Type 'typeof WantsInputs' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|394 col 24-54 error 2344| Type 'typeof WantsFeeRange' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|395 col 24-60 error 2344| Type 'typeof ProvisionalProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|396 col 24-56 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|400 col 25-57 error 2344| Type 'typeof PayjoinProposal' does not satisfy the constraint 'abstract new (...args: any) => any'. Cannot assign a 'private' constructor type to a 'public' constructor type. payjoin-ffi/javascript/test/integration.test.ts|594 col 48-69 error 2345| Argument of type 'ArrayBufferLike' is not assignable to parameter of type 'ArrayBuffer'. Type 'SharedArrayBuffer' is not assignable to type 'ArrayBuffer'. Types of property '[Symbol.toStringTag]' are incompatible. Type '"SharedArrayBuffer"' is not assignable to type '"ArrayBuffer"'. payjoin-ffi/javascript/test/integration.test.ts|675 col 68-78 error 2339| Property 'Terminal' does not exist on type 'Readonly<{ instanceOf: (obj: any) => obj is PollingForProposalTransitionOutcome; Progress: { new (inner: { psbtBase64: string; }): { readonly tag: PollingForProposalTransitionOutcome_Tags.Progress; readonly inner: Readonly<...>; readonly [uniffiTypeNameSymbol]: "PollingForProposalTransitionOutcome"; }; "new"(inner: ...'.

@benalleng benalleng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Gotcha updated my typescript-languange-server and can now see the inline lsp errors in master.

ACK 93d549a tested in my text editor, looks nice and clean

@benalleng benalleng changed the title Fix types, lints in Python and Typescript tests Fix LSP types, lints in Python and Typescript tests May 21, 2026
@benalleng benalleng merged commit 91f12b3 into payjoin:master May 21, 2026
23 checks passed
@xstoicunicornx

Copy link
Copy Markdown
Collaborator Author

Thanks for updating the description, I realized it was inaccurate mid dog walk.

@benalleng benalleng mentioned this pull request Jun 7, 2026
17 tasks
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.

3 participants