Skip to content

apps/box: 2 jest suites fail importing @functionland/react-native-fula (missing TypeScript declarations) #429

Description

@ehsan6sha

Summary

Two Jest test suites under apps/box/ fail at module-load time because @functionland/react-native-fula does not ship TypeScript declarations and there is no ambient .d.ts shim for it in the monorepo. Pre-existing — discovered during the Blox AI plan work in apps/box (Phase 5 first, recurring through Phases 12, 15, 16, 21).

Failure (TS2307)

src/screens/Diagnostics/__tests__/Diagnostics.test.tsx
src/utils/__tests__/helper.test.ts

  Try `npm i --save-dev @types/functionland__react-native-fula` if it
  exists or add a new declaration (.d.ts) file containing
  `declare module ''@functionland/react-native-fula'';`

  46 | import { fula } from ''@functionland/react-native-fula'';
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Workaround used so far

Phase 5–21 of the Blox AI plan worked around it by extracting pure logic into helper modules (utils/buildFeedbackPayload.ts, utils/parsePendingResponse.ts, utils/anonymizeTranscript.ts, etc.) and testing those — the helpers do not import @functionland/react-native-fula, so their suites pass. 161 jest tests across Phases 12 + 15 + 16 + 21 + baseline all run green via this pattern.

The 2 failing suites are the original full-component tests; they''ve been failing since at least Phase 5 work.

Suggested fix

Two options:

  1. Ambient shim (~30 sec): create apps/box/src/types/react-native-fula.d.ts with:

    declare module ''@functionland/react-native-fula'' {
      // Add narrowed types as needed; permissive default OK for now.
      export const fula: any;
      export const blockchain: any;
      // etc.
    }

    Unblocks the test suites; doesn''t pin the API surface.

  2. Generate / ship .d.ts from the react-native-fula package itself. Bigger work — that package lives in this same monorepo. Adding types + declaration: true to its tsconfig would produce real types instead of any.

Option 1 is the cheap unblock; option 2 is the right long-term fix.

Why it matters

  • Today: 2 jest suites fail; coverage on full-component tests is unmeasured.
  • Tomorrow: any new test that wants to render a screen importing the fula module gets the same error → encourages further extraction-to-helpers (which is sometimes the right call but is sometimes contorted).

Scope

  • Quick unblock: 1 new .d.ts file under apps/box/src/types/. No code changes.
  • Proper fix: tsconfig change in packages/react-native-fula (if that''s where it lives in this monorepo) + matching package.json types field.

Discovered during

Blox AI plan (parent: anthropic-snuggly-finch) Phase 5 first, recurring through Phases 12, 15, 16, 21. Documented in ~/.claude/plans/i-am-running-fula-ota-snuggly-finch.md.

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