-
Notifications
You must be signed in to change notification settings - Fork 63
[no-var][semi] behaviour for interfaces and declare var #266
Comments
commented on the wrong issue - comment moved to #268 |
As for your interface Object {
foo(): string,
}
declare var Object: {
new (value?: any): Object,
foo(): string
} // error: Missing semicolon. use
declare namespace CodeMirror {
export var Doc : CodeMirror.DocConstructor;
var version: string;
}
declare namespace CodeMirror {
export var Doc : CodeMirror.DocConstructor // error: Missing semicolon.
var version: string // error: Missing semicolon.
}
|
some time ago i added support for declare: JamesHenry/typescript-estree#42 there are going to be a lot of changes / fixes to existing rules after |
My earlier comment was about I would say that the errors are correct. declare namespace CodeMirror {
export var Doc : CodeMirror.DocConstructor; // error: Unexpected var, use let or const instead.
var version: string; // error: Unexpected var, use let or const instead.
} You should instead use interface Object {
foo(): string,
}
declare var Object: { // error: Unexpected var, use let or const instead.
new (value?: any): Object,
foo(): string
} It's hard to say without knowing your use case; but I think that this is probably incorrect use of Though we could add support for skipping |
My mistake: the |
Repro
See below.
Expected Result
No
no-var
errors.semi
errors for the three lines inside the curly braces. (I'm not sure if commas are valid, it seems typescript is quite lenient about them). No errors after the curly braces.Actual Result
no-var
errors.no
semi
errors but after the last curly brace.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: