microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.29k stars 12.39k forks source link

angular4 autoimport problem #17705

Closed mjbvz closed 6 years ago

mjbvz commented 7 years ago

From @GilHyeon on August 8, 2017 5:29

I wrote code Angular4 with vscode. some module auto import is wrong.

for example, Routes, RouterModule auto import like this

import { Routes, RouterModule } from "@angular/router/router";

but it's not correct. this is correct import statement

import { Routes, RouterModule } from "@angular/router";

this problem have also 'angular/forms' modules import

// wrong import
import { FormGroup } from "@angular/forms/forms";

// correct import 
import { FormGroup } from "@angular/forms";

Steps to Reproduce:

  1. wrote Routes and click yellow lamb.
  2. select import but there is no correct import statement
    • this step has 3 recommend statements
      import { Routes } from "@angular/router/src";
      import { Routes } from "@angular/router/public_api";
      import { Routes } from "@angular/router/router";
  3. I select third statement. but it occurred build error.
  4. I changed statement correctly
    import { Routes } from "@angular/router
  5. next, RouterModule add auto import is done correctly like this
    import { Routes, RouterModule } from "@angular/router";

Reproduces without extensions: Yes

Copied from original issue: Microsoft/vscode#32120

mhegazy commented 6 years ago

@andy-ms you have been looking into similar changes recently.. we should make sure when de-duplicating entries to keep the outer most reporting module.

mhegazy commented 6 years ago

Seems like a duplicate of https://github.com/Microsoft/TypeScript/issues/19889 https://github.com/Microsoft/TypeScript/issues/19889 and https://github.com/Microsoft/TypeScript/issues/19922

mhegazy commented 6 years ago

Should be fixed by https://github.com/Microsoft/TypeScript/pull/20049

typescript-bot commented 6 years ago

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.