Skip to content

Missing TypeScript Type Definitions for Discord Actions Config #119

Closed

Description

@daveonkels

Date: 2026-01-02
Severity: High (Blocks build)
Status: Unresolved
Related: Discovered after fixing broken pi-ai patch
Upstream Issue: https://github.com/steipete/clawdis (need to report)

Summary

After the pi-ai patch was fixed in commit 6cda8443, a new TypeScript error appeared. The discord.actions configuration type is not properly defined, causing TypeScript to infer never as the key type for isActionEnabled() function calls.

Error Details

src/agents/clawdis-tools.ts(1758,32): error TS2345: Argument of type '"reactions"' is not assignable to parameter of type 'never'.
src/agents/clawdis-tools.ts(1772,32): error TS2345: Argument of type '"reactions"' is not assignable to parameter of type 'never'.
src/agents/clawdis-tools.ts(1792,32): error TS2345: Argument of type '"stickers"' is not assignable to parameter of type 'never'.
src/agents/clawdis-tools.ts(1805,32): error TS2345: Argument of type '"polls"' is not assignable to parameter of type 'never'.
// ... 25 more similar errors for: permissions, messages, threads, pins, search, memberInfo, roleInfo, roles, channelInfo, voiceStatus, events, moderation

Additionally:

src/tui/message-list.ts(65,11): error TS2552: Cannot find name 'MessageEntry'. Did you mean 'MessageEvent'?

Root Cause

In src/agents/clawdis-tools.ts at line 1747-1754:

const isActionEnabled = (
  key: keyof NonNullable<typeof cfg.discord>["actions"],  // ← Type inference fails here
  defaultValue = true,
) => {
  const value = cfg.discord?.actions?.[key];
  if (value === undefined) return defaultValue;
  return value !== false;
};

The type NonNullable<typeof cfg.discord>["actions"] resolves to never because:

  1. The discord config type doesn't have an actions property defined, OR
  2. The actions property type is missing the required action keys

Expected Type Definition

The config should include something like:

interface ClawdisConfig {
  discord?: {
    actions?: {
      reactions?: boolean;
      stickers?: boolean;
      polls?: boolean;
      permissions?: boolean;
      messages?: boolean;
      threads?: boolean;
      pins?: boolean;
      search?: boolean;
      memberInfo?: boolean;
      roleInfo?: boolean;
      roles?: boolean;
      channelInfo?: boolean;
      voiceStatus?: boolean;
      events?: boolean;
      moderation?: boolean;
    };
    // ... other discord config
  };
  // ... other config
}

Files Affected

  • src/agents/clawdis-tools.ts (lines 1747-2235) - Discord action checks
  • src/tui/message-list.ts (line 65) - Missing MessageEntry type
  • src/config/config.ts - Likely where the type definition needs to be added

Temporary Workaround

Could use type assertion as a quick fix:

const isActionEnabled = (
  key: string,  // ← Temporary fix
  defaultValue = true,
) => {
  const value = cfg.discord?.actions?.[key as keyof typeof cfg.discord.actions];
  if (value === undefined) return defaultValue;
  return value !== false;
};

Recommended Fix

  1. Add proper type definitions for discord.actions in the config schema
  2. Ensure all action keys are properly typed
  3. Add MessageEntry type export in TUI message list module

Activity

  1. steipete commented on Jan 3, 2026

    @steipete
    Contributor

    Fixed on main via commit 3633c82. Discord action key typing now uses DiscordActionConfig; TUI MessageList now uses explicit MessageRole. Build passes (pnpm build). Closing.

  2. added a commit that references this issue on Feb 7, 2026
  3. locked as resolved and limited conversation to collaborators on Mar 8, 2026
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

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions