-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[no-redeclare] error for declare namespace #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Investigating this case, it's hard for us to deal with this because it's valid typescript. TS augments the the base named thing with the namespace, so in this case, it is completely valid code. We would have to bring in and redefine the Concrete code: function CodeMirror(arg: string): boolean {
return true;
}
namespace CodeMirror {
export const foo = 1
}
CodeMirror.foo // type === number
CodeMirror("hi") // valid Declarations only: declare function CodeMirror(arg : string): boolean;
declare namespace CodeMirror {
export const foo = 1
}
CodeMirror.foo // type === number
CodeMirror("hi") // valid |
@bradzacher right now parser is not providing consistent informations about declarations, than we can't really do much for now here. |
+1 have also come across this issue. Would be nice if declaration-merging was supported. |
This also errors on global augmentations, which seems fixable to me b/c it actually only happens when wrapped in a
So you should just be able to look for the Let me know if you'd like a separate issue to track this, or if I've missed something :) |
Just noticed it is actually turned off in the |
In response to your second comment - AFAIK it doesn't catch anything.
This duplicating a TS compiler error is why this issue (and really all scope analysis rules) have been sitting open for 1yr+++. To the core maintainers the issues are high effort + low value, and there's yet to be a contributor that has cared enough to look into it. |
Merging into #1856 |
Repro
See below.
Expected Result
No error.
Actual Result
no-redeclare
error fordeclare namespace CodeMirror
line.Additional Info
Versions
eslint-plugin-typescript
1.0.0-rc.0
typescript-eslint-parser
eslint-plugin-typescript/parser
typescript
3.1.6
The text was updated successfully, but these errors were encountered: