Add "implicit any" warning for shorthand ambient modules

This commit is contained in:
Andy Hanson 2016-06-06 08:14:49 -07:00
parent ed6bfcdb08
commit f832488801
4 changed files with 21 additions and 0 deletions

View file

@ -16048,6 +16048,12 @@ namespace ts {
}
}
}
if (compilerOptions.noImplicitAny && !node.body) {
// Ambient shorthand module is an implicit any
reportImplicitAnyError(node, anyType);
}
if (node.body) {
checkSourceElement(node.body);
}

View file

@ -0,0 +1,8 @@
tests/cases/conformance/ambient/ambientShorthand_isImplicitAny.ts(1,16): error TS7005: Variable '"jquery"' implicitly has an 'any' type.
==== tests/cases/conformance/ambient/ambientShorthand_isImplicitAny.ts (1 errors) ====
declare module "jquery";
~~~~~~~~
!!! error TS7005: Variable '"jquery"' implicitly has an 'any' type.

View file

@ -0,0 +1,5 @@
//// [ambientShorthand_isImplicitAny.ts]
declare module "jquery";
//// [ambientShorthand_isImplicitAny.js]

View file

@ -0,0 +1,2 @@
// @noImplicitAny: true
declare module "jquery";