You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeScript language service breaks down when wrong casing is used for imports #5430
I was experiencing a bizarre issue where the TS language service broke down and wouldn't underline errors in my code. After pulling my hair out for half an hour, I figured out it was because I was doing a file import with the wrong case e.g.
import Engine from "./Engine"
instead of
import Engine from "./engine"
The default class exported was named 'Engine' which I think might have also had something to do with it.
Open the attached folder in VS Code, then pick the "engine.ts" file and notice that there is an undefined symbol ("jjj_this_is_an_error") that is not red underlined.
I would expect a better error on the erroneous import instead of the imported file no longer having proper language services. :)
The issue is that tsserver was using a case sensitive map to store files, so looking up a file with a different case did not work. this should be fixed in TS 1.7, by #5436.
Now ideally, you would want a warring if you reference a module with the wring case, for this use the new flag --forceConsistentCasingInFileNames added in #5275, to check that you always reference the same file using consistent naming this will be available in TS 1.8.
Activity
mhegazy commentedon Oct 28, 2015
looks like #5149.
I do agree a better experience is needed here.
mhegazy commentedon Oct 28, 2015
Vladimir Matveev (@vladima), what can we do here?
mhegazy commentedon Oct 28, 2015
thanks to Vladimir Matveev (@vladima), this is not a duplicate, this is a bug in tsserver. fix queued.
Fix #5430: Use FileMap instead of a simple Map for storing file list …
mhegazy commentedon Oct 28, 2015
The issue is that tsserver was using a case sensitive map to store files, so looking up a file with a different case did not work. this should be fixed in TS 1.7, by #5436.
Now ideally, you would want a warring if you reference a module with the wring case, for this use the new flag
--forceConsistentCasingInFileNamesadded in #5275, to check that you always reference the same file using consistent naming this will be available in TS 1.8.Merge pull request #5436 from Microsoft/fix5430
xirzec commentedon Oct 29, 2015
Mohamed Hegazy (@mhegazy) Thanks for the quick fix! 👍