Skip to content

Getting import errors on modules using alias in tsconfig #20132

@FieldMarshallVague

Description

@FieldMarshallVague

I'm getting intellisense (red squiggles) on my aliased imports, but the project builds OK and runs without error.

Please note, this is a similar issue to the one referenced here (but this is related to aliasing paths): #10346

But, it differs in that I am using an alias for the app folder. It seems that the tsserver doesn't see the modules via the alias. I Installed TS 2.7.0-dev.20171118 and still have the error after reloading window (F1 > reload window in VS Code)

image

image

image

The project compiles OK, but this error appears in VS Code and their repo assigned the error to the TS team as it was being thrown by the TSServer, so this seems like the right place for this issue, also. Original VS Code issue was: microsoft/vscode#10391

The structure is:

image

I've also tried avoiding the use of 'barrels' (i.e. the index.ts files exporting the modules) and the problem is the same. The project builds with and without the barrels, though.

If I reference the modules the classic way, then it works fine:

image

Expected behavior:
That the (d)red squigglies won't appear for correctly referenced modules.

Actual behavior:
Red squigglies appear despite correct references.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions