Closed
Description
TypeScript Version: typescript@2.9.0-dev.20180328
Search Terms: organize imports declaration
Code
Take this file:
import {NoteStore} from "./NoteStore";
import {Note} from "./Note";
export class SomeClass {
constructor(private readonly noteStore: NoteStore) {
}
getNotes() {
// implicit return type: Note[]
return this.noteStore.getValues();
}
}
With compiler option declaration: true
Expected behavior:
import {Note} from "./Note";
import {NoteStore} from "./NoteStore";
// ...class declaration omitted...
Actual behavior:
import {NoteStore} from "./NoteStore";
// ...class declaration omitted...
And causes this compile error: Return type of public method from exported class has or is using name 'Note' from external module "fileNameGoesHere.ts" but cannot be named.
Playground Link: N/A
By the way, I ran "organize imports" on about 800 files. Works really well other than this problem and it puts imports that were previously on multiple lines onto one... so that will break my linting rule for "max-line-length". Luckily it's easy to write a script to investigate and break them back onto multiple lines 😄