Skip to content

chore(tests): flip tsconfig.test.json noImplicitAny to true #3563

@oliverlaz

Description

@oliverlaz

Follow-up to #3562.

Context

PR #3562 migrated the test suite to TypeScript and got yarn test:typecheck to 0 errors with noImplicitAny: false in package/tsconfig.test.json. Flipping it to true exposes ~630 additional errors, all mechanical annotations on:

  • Destructured parameters in test helpers (e.g. renderComponent({ client, channel, props })).
  • Untyped let variables at describe scope (e.g. let chatClient without an annotation).
  • jest.fn() callback bodies.

All errors are in test files (plus one: src/components/Message/MessageItemView/utils/renderText.tsx where the untyped react-native-markdown-package import is currently handled via @ts-ignore).

Scope

  • Flip noImplicitAny: true in package/tsconfig.test.json (remove the TODO comment).
  • Annotate the ~630 implicit-any call sites. Conventions to follow (same as PR refactor(tests): migrate test suite and mock-builders to TypeScript #3562):
    • Prefer SDK types from stream-chat (StreamChat, Channel, LocalMessage, MessageResponse, UserResponse, ChannelMemberResponse, etc.).
    • Use ComponentProps<typeof X> for render-helper prop args.
    • Avoid any and as any. as unknown as T is acceptable where SDK type narrowing isn't possible.
  • Keep yarn test:typecheck at 0 errors.

Out of scope (separate follow-ups)

  • package/src/store/apis/upsertDraft.ts:55queries.concat(query) is a no-op; should be queries.push(...query).
  • MessageStatus.test.tsxit.each('string', fn) was malformed; currently it.skip. Un-skip and rewrite as proper assertions.

Acceptance

  • yarn test:typecheck passes with noImplicitAny: true.
  • yarn test:unit suite unchanged (same pre-existing SQLite-isolation flake, no new regressions).
  • yarn build and yarn lint unchanged.

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