Repository navigation
TypeScript types for the wasm verifier reports - #21
Merged
Merged
Conversation
verify and inspect returned plain objects, so the generated .d.ts typed them as any. A typescript_custom_section now describes VerifyReport, Rejection, CertifiedLedger, OrgAgreement, the two claim kinds, DecodedEvent and InspectReport, matching externalize_core::report, and unchecked_return_type puts them on verify (VerifyReport | Rejection) and inspect (InspectReport). Checking report.verified narrows the union, and claims narrow on kind. node.cjs now asserts the .d.ts exports the types and signatures. Locally, a strict tsc consumer that narrows both unions type-checks. Closes #5.
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 #5.
verifyandinspectreturned plain objects, so the generated.d.tstyped them asany. They're typed now:A
typescript_custom_sectiondescribes the following types, matchingexternalize_core::reportfield for field:VerifyReport,RejectionCertifiedLedger,OrgAgreementTransactionClaim | InvocationClaimDecodedEventInspectReportunchecked_return_typeattaches these types to the two functions. The report's shape doesn't change.Done-when from the issue
externalize_wasm.d.tsexports the new types.node.cjsnow asserts every type and both signatures, so CI's wasm job checks this.crates/externalize-wasm/tests/node.cjsstill passes.Checked
wasm-bindgen --target nodejs, thennode.cjs.tsc --strictpasses on a consumer that narrows on both unions.cargo fmt --checkand clippy on the crate.