ts1261-filename-casing

Fix TypeScript TS1261 errors caused by filename casing mismatches between imports and git index.

1.0k|454|Updated Jun 21, 2017
One-click install
npx skills add https://github.com/forcedotcom/salesforcedx-vscode --skill ts1261-filename-casing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ts1261-filename-casing
Source: https://github.com/forcedotcom/salesforcedx-vscode/tree/main/.claude/skills/ts1261-filename-casing
Command: npx skills add https://github.com/forcedotcom/salesforcedx-vscode --skill ts1261-filename-casing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TypeScript compilation fails with error TS1261 ("Already included file name ... differs from file name ... only in casing") when the same file is referenced with different casing in imports versus the git index or include paths, especially on case-insensitive filesystems like macOS and Windows.

Core Features & Use Cases

  • Diagnose casing conflicts: Identify both casing spellings reported in TS1261 diagnostics and determine which one matches existing imports.
  • Two-step git rename workflow: Perform case-only renames using a temporary intermediate filename so git and the filesystem both register the change on case-insensitive filesystems.
  • Verification checklist: Confirm the fix by re-running compilation and checking git ls-files output for a single correctly-cased entry.
  • Use Case: A repo tracks fooBar.ts in git but code imports ./FooBar; use this Skill to rename the file via a two-step git mv and get a clean compile.

Quick Start

Fix the TS1261 casing error in my project by renaming the mismatched file with a two-step git mv and re-running the compile.

Frequently Asked Questions about ts1261-filename-casing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix TypeScript error TS1261 file name differs only in casing?

Identify both casing spellings in the TS1261 message, choose the one matching your imports, then rename the file with a two-step git mv through a temporary name. Re-run your compile command to confirm the error is gone.

Why does git mv with a single case-only rename not work?

On case-insensitive filesystems like macOS and Windows, `git mv a.ts A.ts` often no-ops or fails because both paths resolve to the same file. A two-step move through a temporary name forces git and the filesystem to register the change.

Does this casing issue happen on Linux?

Linux filesystems are typically case-sensitive, so case-only renames work directly and TS1261 casing conflicts are rare. The two-step rename workflow is primarily needed on macOS and Windows default filesystems.

How do I verify the filename casing fix worked?

Re-run your compile command (for example npm run compile) and check that TS1261 no longer appears. Also run `git ls-files` on the directory and grep for the basename to confirm a single entry whose casing matches your imports.

When should I use git rm --cached instead of git mv for casing fixes?

Use `git rm --cached` only to remove a stale wrong-cased index entry, but you still must place the content on disk under the correct casing. The two-step git mv updates both the index and working tree in one workflow, avoiding a detached delete step.