Skip to content

fix: resolve TS2411 in use-slash-completions#39338

Closed
shawn137080 wants to merge 1 commit into
NousResearch:mainfrom
shawn137080:fix/tsc-slash-completions
Closed

fix: resolve TS2411 in use-slash-completions#39338
shawn137080 wants to merge 1 commit into
NousResearch:mainfrom
shawn137080:fix/tsc-slash-completions

Conversation

@shawn137080

Copy link
Copy Markdown

Summary

Fixes a TypeScript build error (TS2411) in the desktop app's slash completions hook.

Problem

The SlashItemMetadata interface extends Record<string, string> but declares rawText?: string. Since string | undefined is not assignable to the string index type, builds fail with:

src/app/chat/composer/hooks/use-slash-completions.ts:19:3 - error TS2411: Property 'rawText' of type 'string | undefined' is not assignable to 'string' index type 'string'.

Fix

Changed the interface to a typed object with explicit required fields, making rawText required (which it already is in practice):

// Before
interface SlashItemMetadata extends Record<string, string> {
  command: string
  display: string
  meta: string
  rawText?: string  // conflicts with Record<string, string>
}

// After
type SlashItemMetadata = {
  command: string
  display: string
  meta: string
  rawText: string
}

Testing

  • tsc -b in apps/desktop compiles cleanly with no errors

The optional rawText?: string field conflicted with the Record<string, string>
index signature, causing TS2411 on builds with strict index signature
checking. Changed to a typed object with explicit required fields.
@shawn137080

Copy link
Copy Markdown
Author

This PR fixes the TS2411 error described in issue #39332. The fix changes the SlashItemMetadata interface from extending Record<string, string> with an optional rawText?: string (which causes the type conflict) to a plain typed object with explicit required fields.

Confirmed fixed on a clean install — tsc -b in apps/desktop now compiles cleanly.

Fixes #39332

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists labels Jun 4, 2026
@ethernet8023

Copy link
Copy Markdown
Collaborator

already fixed by #39334

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

Labels

P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants