[MODEL] Porting JS to TS Relies Too Much On Feedback From TSC

Resolved 💬 1 comment Opened May 31, 2026 by joeedh Closed Jul 3, 2026

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] 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_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗