Skip to content

Language Service: does not work with "paths" from .tsconfig #16382

@karptonite

Description

@karptonite

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
Set "paths" and "baseUrl" in tsconfig. for example:

"compilerOptions": {
  "baseUrl": "src",
  "paths": {
    "@myapp/*": [
        "app/*"
      ]
    },
}

Then import a component in a module using the path set via paths.

import {HeaderComponent} from  "@myapp/header/header.component";

Add {{foo}} to header.component.html. The error reported is "Unresolved variable or type foo".
The import seems to work fine, otherwise.

Expected behavior
The error should be: "Angular: Identifier 'foo' is not defined. The component declaration, template variable declarations, and element references do not contain such a member". This is the error that is reported if the import is done via a relative link, e.g, "./header/header.component"

Minimal reproduction of the problem with instructions
As described above.

What is the motivation / use case for changing the behavior?
To get proper errors via language service when using absolute paths for imports.

Please tell us about your environment:
PhpStorm 2017.1.3, MacOS 10.12.4.

  • Angular version: 4.1.0

  • Browser: N/A

  • Language: Typescript

  • Node (for AoT issues): node --version = 7.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: language-serviceIssues related to Angular's VS Code language service

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions