TypeScript: `forceConsistentCasingInFileNames: true` and `moduleResolution: Node16` break type reference directives on macOS if there are capital letters in the path
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): https://github.com/microsoft/TypeScript/issues/16875, https://github.com/microsoft/TypeScript/issues/20003, https://github.com/microsoft/TypeScript/issues/17617, https://github.com/microsoft/TypeScript/issues/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/index.d.ts@18.0.17'
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.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (2 by maintainers)
Commits related to this issue
- Do not canonicalize the file names when getting absolute paths Fixes #50544 — committed to microsoft/TypeScript by sheetalkamat 2 years ago
- Cherry-pick PR #50557 into release-4.8 Component commits: 0cb4514766 Add test to show how scope messes with casing a3ea961838 Do not canonicalize the file names when getting absolute paths Fixes #50... — committed to typescript-bot/TypeScript by sheetalkamat 2 years ago
- Do not canonicalize the file names when getting absolute paths during nodenext resolution (#50557) * Add test to show how scope messes with casing * Do not canonicalize the file names when getting... — committed to microsoft/TypeScript by sheetalkamat 2 years ago
- Cherry-pick PR #50557 into release-4.8 (#50576) Component commits: 0cb4514766 Add test to show how scope messes with casing a3ea961838 Do not canonicalize the file names when getting absolute pat... — committed to microsoft/TypeScript by typescript-bot 2 years ago
- Update dependency typescript to v4.9.4 (#1642) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [typescript](https://www.typescriptlang.org/) ([source... — committed to Calciumdibromid/CaBr2 by deleted user a year ago
- Update dependency typescript to v5 (#275) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [typescript](https://www.typescriptlang.org/) ([source](htt... — committed to Vylpes/vylbot-app by deleted user a year ago
can still reproduce with typescript 4.8.3 + windows 11:
reproduction here: https://github.com/wight554/blog-template/pull/59
Sure, hereās some trace output. Thereās a lot of it so Iām only including the section related to my error above.
This seems related to #45509 -> #45096 -> #10340