Fix LSP types, lints in Python and Typescript tests#1571
Merged
Conversation
Collaborator
Coverage Report for CI Build 26234911526Coverage remained the same at 85.14%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
benalleng
reviewed
May 21, 2026
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)>; | ||
|
|
Collaborator
There was a problem hiding this comment.
Was this causing lint errors or just a readability enhancement you decided to make?
Collaborator
Author
There was a problem hiding this comment.
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.
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: ...'. |
Collaborator
Author
|
Thanks for updating the description, I realized it was inaccurate mid dog walk. |
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.
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
treefmtlinting CI errors that were produced when initially pushing this branch.Please confirm the following before requesting review:
AI
in the body of this PR.