Naming convention for Typescript type definition files in VS2017?

Viewed 1101

I installed type definitions for AngularJS, Jasmine and jQuery through NuGet: typings-files structure

This is my tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "module": "umd",
    "sourceMap": true,
    "typeRoots": [ "./Scripts/typings" ],
    "types": [ "jasmine", "angularjs", "jquery" ]
  },
  "compileOnSave": true,
  "include": [
    "Areas/Internet/Scripts/**/*.ts",
    "Areas/Internet/Scripts/*.ts"
  ]
}

When building the project I get these errors:

Error       Build:Cannot find type definition file for 'jquery'.
Error       Build:Cannot find type definition file for 'jasmine'.
Error       Build:Cannot find type definition file for 'angularjs'.

The problem is solved by creating an index.d.ts file in each folder, referencing the other files -- eg for angularjs, index.d.ts looks like:

/// <reference path="angular.d.ts" />
/// <reference path="angular-animate.d.ts" />
/// <reference path="angular-component-router.d.ts" />
/// <reference path="angular-cookies.d.ts" />
/// <reference path="angular-mocks.d.ts" />
/// <reference path="angular-resource.d.ts" />
/// <reference path="angular-route.d.ts" />
/// <reference path="angular-sanitize.d.ts" />

I'm just wondering why it is necessary to have a file named index. Seems like the nuget-installation should make it work by default, and I couldn't find anything about this in the docs.

0 Answers
Related