-
Notifications
You must be signed in to change notification settings - Fork 889
Import declaration conflict not detected with import { Foo } from
statement
#2921
Comments
I added this to my PR #2598 Though you won't get a lint error for your code snippet above, because both declarations are in the same scope. But you get a compile error for that anyway. But the following will work as expected: import { Foo } from './foo';
{
const Foo = 'bar'; // error: shadowed name 'Foo'
} |
Shouldn't my code snippet produce the following error then?
If the following snippet produces that error, my initial one should do that as well as it's incorrect. import * as Foo from './foo';
const Foo = 'foo'; So it's pretty nice that you covered that case, I think it only solves a part of the issue. Thanks for looking into it btw :)! |
It's actually
|
So I should rather create an issue in the TypeScript repository concerning the issue that it's not throwing the import { Foo } from './foo';
const Foo = 'bar'; |
Yes, you should create an issue in the TypeScript repo if you don't see the expected error message. |
Strange. I used the latest TypeScript but it doesn't give me the error. Took a screen capture. But will open this one in the TypeScript repository and link to this thread. Thanks for the information @ajafff! |
Bug Report
TypeScript code being linted
foo.ts
main.ts
with
tslint.json
configuration:Actual behavior
TSLint doesn't catch that
Foo
is being redefined.Expected behavior
TSLint should fail with the following error
At first I thought this had something to do with the
no-shadowed-variable
rule, but now I don't think it is the case anymore. Whenever you changemain.ts
to something like thisIt detects the conflict and throws an error.
The text was updated successfully, but these errors were encountered: