Skip to content

TypeScript language service breaks down when wrong casing is used for imports #5430

Closed

Description

Copied from: https://code.visualstudio.com/Issues/Detail/20178

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. :)

Activity

  1. mhegazy commented on Oct 28, 2015

    @mhegazy
    Contributor

    looks like #5149.

    I do agree a better experience is needed here.

  2. mhegazy commented on Oct 28, 2015

    @mhegazy
    Contributor

    Vladimir Matveev (@vladima), what can we do here?

  3. added
    DuplicateAn existing issue was already created
    BugA bug in TypeScript
    and removed
    BugA bug in TypeScript
    DuplicateAn existing issue was already created
    on Oct 28, 2015
  4. mhegazy commented on Oct 28, 2015

    @mhegazy
    Contributor

    thanks to Vladimir Matveev (@vladima), this is not a duplicate, this is a bug in tsserver. fix queued.

  5. added a commit that references this issue on Oct 28, 2015
    616b0d7
  6. mhegazy commented on Oct 28, 2015

    @mhegazy
    Contributor

    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.

  7. added a commit that references this issue on Oct 28, 2015
    7d99460
  8. xirzec commented on Oct 29, 2015

    @xirzec
    Member

    Mohamed Hegazy (@mhegazy) Thanks for the quick fix! 👍

  9. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions