Skip to content

fix(types): eliminate all any types and add error type narrowing#35

Merged
namastex888 merged 1 commit intodevfrom
fix/type-safety
Mar 30, 2026
Merged

fix(types): eliminate all any types and add error type narrowing#35
namastex888 merged 1 commit intodevfrom
fix/type-safety

Conversation

@namastex888
Copy link
Copy Markdown
Collaborator

Summary

  • Removed all explicit any type annotations across src/
  • getModel(): as anyas KnownProvider / as never
  • Response content blocks: as anyas unknown as Record<string, unknown> with TextContent type guard
  • usage.cost: as anyas unknown as Record<string, unknown> (not in pi/ai public types)
  • thinkingLevel: narrowed from string | null to ThinkingLevel | null in GeminiConfig
  • replContext: as any → proper REPLStartOptions type
  • All catch (err: any) / catch (err)catch (err: unknown) with instanceof Error guards

Validation

  • tsc --noEmit passes with zero errors
  • grep -rn 'as any\|: any\|catch (err)' src/ returns zero matches (excluding scaffold.ts template)
  • 142/142 tests pass

Replaces #27 (closed as stale — wrong base branch)

- Replace `as any` with proper type casts (KnownProvider, TextContent, etc.)
- Change all `catch (err: any)` / `catch (err)` to `catch (err: unknown)` with instanceof guards
- Narrow GeminiConfig.thinkingLevel from `string | null` to `ThinkingLevel | null`
- Use `unknown` intermediate cast for pi/ai usage.cost access (not in public types)
- Zero `any` annotations remaining in src/
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 30, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 56cb9d14-eac3-4340-8edb-b573276b070d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/type-safety

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@namastex888 namastex888 merged commit d18b7b3 into dev Mar 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants