Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forceConsistentCasingInFileNames doesn't work as advertisted #54642

Closed
OliverJAsh opened this issue Jun 14, 2023 · 4 comments
Closed

forceConsistentCasingInFileNames doesn't work as advertisted #54642

OliverJAsh opened this issue Jun 14, 2023 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@OliverJAsh
Copy link
Contributor

Bug Report

🔎 Search Terms

  • forceConsistentCasingInFileNames
  • casing

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about forceConsistentCasingInFileNames

💻 Code

tsconfig.json:

{
  "compilerOptions": {
    "forceConsistentCasingInFileNames": true
  },
  "files": ["./src/main.ts"]
}

src/main.ts:

// Casing is incorrect here, but there's no type error (on macOS at least).
import { foo } from "./FOO";

console.log(foo);

src/foo.ts:

export const foo = 1;

🙁 Actual behavior

Testing on macOS (case insensitive file system), there is no type error (in my editor and when I run tsc).

🙂 Expected behavior

There should be a type error due to incorrect casing for import { foo } from "./FOO";, as per the documentation for forceConsistentCasingInFileNames:

When [forceConsistentCasingInFileNames] is set, TypeScript will issue an error if a program tries to include a file by a casing different from the casing on disk.

https://www.typescriptlang.org/tsconfig#forceConsistentCasingInFileNames

@MartinJohns
Copy link
Contributor

Or alternatively, the documentation should be fixed, because as far as I know the behaviour is intentional and will only warn about mixing casing within your code base (link to issue mentioning this missing).

You want #21736.

@OliverJAsh
Copy link
Contributor Author

Thanks, that makes sense! In that case I think this is just a documentation issue.

@fatcerberus
Copy link

Current behavior may not be intentional: #21736 (comment)

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jun 14, 2023
@typescript-bot
Copy link
Collaborator

This issue has been marked as 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

5 participants