Tuesday, December 6, 2016

TypeScript File index.d.ts is not a module

After publishing my blog post yesterday about type definition files I got a problem when I tried to do the same thing for Modernizr:

image

Visual Studio finds my @types files but complains that it is not a valid module. In fact this makes sense. When using the import syntax, Typescript is looking for a 'module' i.e. a commonjs, amd, systemjs or umd module. Modernizr is added to the global namespace and is not available as a module.

To get intellisense, I have to use the ///<reference path=””/> syntax

image

No comments: