I added the typings for datatables.net via nuget. After that I kept getting errors like:
Error TS2322 Type '{ dom: string; }' is not assignable to type 'Settings'. Property 'oFeatures' is missing in type '{ dom: string; }'.
I finally realized that the nuget package dropped two typings files in /scripts/typings:
- jquery.dataTables-1.9.4.d.ts
- jquery.dataTables.d.ts
Commenting out the entire 1.9.4 file fixed my issue, but this made me ask the question: How did visual studio determine to include that file to begin with? I expected to need ///reference declarations at the top of the file but apparently not. Does vs2015 just pick up all d.ts files? Is there a way to exclude a file other than deleting it or commenting it out?
Visual studio should be able to pick up definitions automatically.
To exclude definition from project use "exclude" section of : tsconfig.json to specify what files to exclude.
JQuery DataTables changed rather dramatically (and, in my opinion, much for the better) with version 1.10.x. This is the jquery.dataTables.d.ts file.
If you are planning to use only version 1.10.x, you should simply delete the 1.9.4 version, which I presume was included for those still using the older versions.
来源:https://stackoverflow.com/questions/35733182/how-does-visual-studio-2015-resolve-typescript-typings-d-ts-files