3.13.0 and 3.14.0-dev.01.8.10 and 2.0.0 declare module "*";
with tslint.json configuration:
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-finally",
"check-whitespace"
],
if (body.kind === ts.SyntaxKind.ModuleBlock) {
^
TypeError: Cannot read property 'kind' of undefined
at OneLineWalker.visitModuleDeclaration (c:\dev\sandbox\node_modules\tslint\lib\rules\oneLineRule.js:163:17)
at OneLineWalker.SyntaxWalker.visitNode (c:\dev\sandbox\node_modules\tslint\lib\language\walker\syntaxWalker.js:366:22)
at c:\dev\sandbox\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63
at visitEachNode (c:\dev\sandbox\node_modules\typescript\lib\typescript.js:7959:30)
at Object.forEachChild (c:\dev\sandbox\node_modules\typescript\lib\typescript.js:8117:24)
at OneLineWalker.SyntaxWalker.walkChildren (c:\dev\sandbox\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12)
at OneLineWalker.SyntaxWalker.visitSourceFile (c:\dev\sandbox\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14)
at OneLineWalker.SyntaxWalker.visitNode (c:\dev\sandbox\node_modules\tslint\lib\language\walker\syntaxWalker.js:414:22)
at OneLineWalker.SyntaxWalker.walk (c:\dev\sandbox\node_modules\tslint\lib\language\walker\syntaxWalker.js:7:14)
at Rule.AbstractRule.applyWithWalker (c:\dev\sandbox\node_modules\tslint\lib\language\rule\abstractRule.js:19:16)
at Rule.apply (c:\dev\sandbox\node_modules\tslint\lib\rules\oneLineRule.js:21:21)
To not error.
It looks like TypeScript only just recently added wildcard support to ambient module declaration in June to TypeScript 2.0.0. See TypeScript Issue#6615.
Also relevant from their What's New In TypeScript 2.0 wiki entry:
WildChard module names can be even more useful when migrating from an un-typed code base. Combined with Shorthand ambient module declarations, a set of modules can be easily declared as any.
Example
declare module "myLibrary/*";
Should be fairly straightforward to check for this new syntax and not visit the non-existent module block in OneLineWalker if anyone wants to send a bugfix PR.
Was this resolved by #1429 and can be closed?
@macklinu the changes in the commit from #1429 do, indeed, resolve this issue.
Did this get any release? I'm having this bug in 3.15.1
I am getting similar with Webstorm trying to declare a module:
declare module "test";
INFO - avascript.linter.tslint.TsLint - TsLint inner error. TsLint version: 3.15.1
TypeError: Cannot read property 'kind' of undefined
Oh, looks like this might be coming in Version 4.
"The changes in #1429 will be available in the next TSLint release, which will be 4.0"
Thanks @arlair I did not see that issue.
What is the reason that a line like
/* tslint:disable */
declare module "test";
before the declare module doesn't work? I am in a situation where this would be the only solution until 4.0 is released, but I'm having no luck.
hey folks, sorry for the pain around this bug. I'll cut a new release on the next branch which you can depend on to get the latest TSLint fixes.
Having the same problem and // tslint:disable-next-line does not work either.
v4.0.0-dev.0 is available now (npm install tslint@next), can you try that?
@adidahiya Yes that works!
Work! Thanks! :)
npm install tslint@next helps me
Most helpful comment
hey folks, sorry for the pain around this bug. I'll cut a new release on the
nextbranch which you can depend on to get the latest TSLint fixes.