Skip to content

Predicate runtime exports are missing from TypeScript declarations #15

Description

@Kewe63

Summary

The package root exports seven Predicate-related runtime values/functions that are absent from the published TypeScript declarations. JavaScript consumers can import them from @fairblock/stabletrust, while strict TypeScript consumers receive TS2305 for the same imports.

Affected exports:

  • APPLY_PENDING_SIGNATURE
  • CREATE_CONFIDENTIAL_ACCOUNT_SIGNATURE
  • DEPOSIT_SIGNATURE
  • PREDICATE_ATTESTATION_SIGNATURE
  • emptyPredicateAttestation
  • injectPredicateAttestation
  • isPredicateAttestation

Tested on:

  • repository SHA: 7a3faaa5f7e136ea3fafaefd1bc6541a9a5954fe
  • package: @fairblock/stabletrust@2.0.15
  • TypeScript: 5.9.2
  • Node.js: v22.23.1

Expected behavior

Values and functions exported by the package's public runtime entrypoint should also be available from its configured TypeScript declaration entrypoint.

Actual behavior

All seven names exist and import successfully at runtime on Node 18 and Node 22. Compiling equivalent TypeScript imports produces seven TS2305 diagnostics and exits with code 2.

Reproduction

Create a clean directory and install:

npm install @fairblock/stabletrust@2.0.15 typescript@5.9.2

Save as repro.ts:

import {
  APPLY_PENDING_SIGNATURE,
  CREATE_CONFIDENTIAL_ACCOUNT_SIGNATURE,
  DEPOSIT_SIGNATURE,
  PREDICATE_ATTESTATION_SIGNATURE,
  emptyPredicateAttestation,
  injectPredicateAttestation,
  isPredicateAttestation,
} from "@fairblock/stabletrust";

const attestation = emptyPredicateAttestation();
void injectPredicateAttestation("applyPending", []);
void isPredicateAttestation(attestation);
void [
  APPLY_PENDING_SIGNATURE,
  CREATE_CONFIDENTIAL_ACCOUNT_SIGNATURE,
  DEPOSIT_SIGNATURE,
  PREDICATE_ATTESTATION_SIGNATURE,
];

Compile:

npx tsc --noEmit \
  --target ES2022 \
  --module NodeNext \
  --moduleResolution NodeNext \
  --strict \
  --skipLibCheck false \
  repro.ts

Observed result:

error TS2305: Module '"@fairblock/stabletrust"' has no exported member 'APPLY_PENDING_SIGNATURE'.
error TS2305: Module '"@fairblock/stabletrust"' has no exported member 'CREATE_CONFIDENTIAL_ACCOUNT_SIGNATURE'.
error TS2305: Module '"@fairblock/stabletrust"' has no exported member 'DEPOSIT_SIGNATURE'.
error TS2305: Module '"@fairblock/stabletrust"' has no exported member 'PREDICATE_ATTESTATION_SIGNATURE'.
error TS2305: Module '"@fairblock/stabletrust"' has no exported member 'emptyPredicateAttestation'.
error TS2305: Module '"@fairblock/stabletrust"' has no exported member 'injectPredicateAttestation'.
error TS2305: Module '"@fairblock/stabletrust"' has no exported member 'isPredicateAttestation'.
TSC_EXIT=2

A runtime control importing the same seven names from the same installed package exits successfully.

Root cause

Merged PR #7 added the Predicate constants and helpers to src/index.js, src/constants.js, and src/predicate-contract.js, but did not update src/index.d.ts or the supplemental src/withdrawal-fees.d.ts used by the package's types entrypoint.

The package therefore publishes a runtime surface newer than its declaration surface.

Impact

TypeScript applications cannot use the current Predicate compatibility helpers and selector constants without local declaration augmentation, casts, or suppression comments, despite those APIs being publicly exported and used by the runtime wrappers.

Suggested fix

  • declare a named Predicate attestation tuple/object type matching the runtime guard;
  • declare the three helper functions with their real argument and return shapes;
  • declare the four signature constants as strings;
  • add a packed clean-consumer TypeScript test that imports every root runtime value introduced by Predicate support.

Duplicate check

I searched open and closed issues/PRs using the seven export names, Predicate typings, TypeScript declarations, and TS2305.

No existing report or open fix for these seven exports was found.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions