Skip to content

forceConsistentCasingInFileNames: true and moduleResolution: Node16 break type reference directives on macOS if there are capital letters in the path #50544

Closed
@alecmev

Description

@alecmev

Bug Report

🔎 Search Terms

forceConsistentCasingInFileNames, moduleResolution, Node16, NodeNext, type reference, "differs from already included file name", "only in casing". Relevant issues (all resolved and predating Node16): #16875, #20003, #17617, #9824

🕗 Version & Regression Information

This is the behavior in every version I tried, and I haven't found any issues or FAQ entries about this. Tested only on 4.8.2, sorry. Looks like this might be recent regression after all.

⏯ Playground Link / 💻 Code

I can't reproduce this in neither the playground nor the workbench nor even Linux. The problem appears only on macOS. Here's a repro: https://github.com/alecmev/typescript-type-reference-lowercase-repro Just npm i and npx tsc.

🙁 Actual behavior

index.ts:2:26 - error TS1149: File name '/users/foo/repro/node_modules/@types/react/index.d.ts' differs from already included file name '/Users/Foo/repro/node_modules/@types/react/index.d.ts' only in casing.
  The file is in the program because:
    Type library referenced via 'react' from file '/Users/Foo/repro/node_modules/@babylonjs/inspector/babylon.inspector.module.d.ts'
    Imported via "react" from file '/Users/Foo/repro/node_modules/@babylonjs/inspector/babylon.inspector.module.d.ts' with packageId '@types/react/[email protected]'

Note /users/foo vs. /Users/Foo.

🙂 Expected behavior

This is valid code and it works on Linux and/or without moduleResolution: Node16. An unnecessary toLowerCase happens somewhere, but I can't really debug this further since I use Linux and had to use my colleague's computer to create the repro. The title of the issue is only a guess, I don't know the root of the issue.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions