Skip to content

Conversation

@solidsnakedev
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings December 27, 2025 20:42
Copy link
Contributor

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 adds comprehensive test coverage for recursive TSchema structures using a MultisigScript example adapted from the Aiken blockchain language. The tests demonstrate how to define and use recursive union types with TSchema, including proper use of Schema.suspend() for handling forward references.

Key Changes:

  • Adds new test file TSchema.recursive.test.ts with 11 test cases covering recursive schema structures
  • Demonstrates recursive union types with nested array fields using Schema.suspend()
  • Tests various nesting depths and edge cases (empty arrays, complex multi-level structures)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

| { readonly Script: { readonly scriptHash: Uint8Array } }

// Define the recursive MultisigScript schema
const MultisigScriptSchema = TSchema.Union(
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

There are extra spaces between the variable name and the equals sign. This should be a single space for consistency with TypeScript formatting conventions.

Suggested change
const MultisigScriptSchema = TSchema.Union(
const MultisigScriptSchema = TSchema.Union(

Copilot uses AI. Check for mistakes.
{
AllOf: TSchema.Struct(
{
scripts: TSchema.Array(Schema.suspend(() : Schema.Schema<MultisigScript, Data.Constr> => MultisigScriptSchema)),
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The type annotation has extra spacing between the colon and Schema.Schema. The spacing should be consistent with TypeScript conventions (single space after colon).

Copilot uses AI. Check for mistakes.
{
AnyOf: TSchema.Struct(
{
scripts: TSchema.Array(Schema.suspend(() : Schema.Schema<MultisigScript, Data.Constr> => MultisigScriptSchema)),
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The type annotation has extra spacing between the colon and Schema.Schema. The spacing should be consistent with TypeScript conventions (single space after colon).

Copilot uses AI. Check for mistakes.
AtLeast: TSchema.Struct(
{
required: TSchema.Integer,
scripts: TSchema.Array(Schema.suspend(() : Schema.Schema<MultisigScript, Data.Constr> => MultisigScriptSchema)),
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The type annotation has extra spacing between the colon and Schema.Schema. The spacing should be consistent with TypeScript conventions (single space after colon).

Copilot uses AI. Check for mistakes.
@solidsnakedev solidsnakedev merged commit 3b2ebfb into main Dec 27, 2025
11 checks passed
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.

2 participants