claude-code - 💡(How to fix) Fix [MODEL] Porting JS to TS Relies Too Much On Feedback From TSC

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Ported Javascript code to Typescript via a feedback loop with the tsc typechecker; it first adds very minimal type annotations to an individual .ts file it renamed from .js, then it invokes tsc. At this point tsc gives basically garbage output, nonetheless Claude fixes every single last diagnostic error with whatever hacks it can (e.g. casts to any bad usages of unknown strange Record types, inline object interfaces as SomeBaseClass & {bleh(): void} etc.). Claude then finds another fit of JS code to add types to and the cycle starts again. The garbage type annotations come to outnumber the correct ones and eventually Claude stops reasoning about the type system altogether and simply adds generic type casts.

Code Example



---
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues for similar behavior reports
  • This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude made incorrect assumptions about my project

What You Asked Claude to Do

Port a JS codebase to Typescript.

What Claude Actually Did

Ported Javascript code to Typescript via a feedback loop with the tsc typechecker; it first adds very minimal type annotations to an individual .ts file it renamed from .js, then it invokes tsc. At this point tsc gives basically garbage output, nonetheless Claude fixes every single last diagnostic error with whatever hacks it can (e.g. casts to any bad usages of unknown strange Record types, inline object interfaces as SomeBaseClass & {bleh(): void} etc.). Claude then finds another fit of JS code to add types to and the cycle starts again. The garbage type annotations come to outnumber the correct ones and eventually Claude stops reasoning about the type system altogether and simply adds generic type casts.

Expected Behavior

I suspect this is a problem with your system prompt. I have had some success forcing Claude to port the codebase to TS entirely without invoking tsc and then fix tsc errors in a second pass (I created a skill for it). But it seems like the proper fix is to correct whatever system prompt is causing claude to excessively invoke tsc when porting javascript code in the first place.

Files Affected

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Yes, every time with the same prompt

Steps to Reproduce

No response

Claude Model

Sonnet

Relevant Conversation

Impact

Critical - Data loss or corrupted project

Claude Code Version

2.1.159

Platform

Anthropic API

Additional Context

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [MODEL] Porting JS to TS Relies Too Much On Feedback From TSC