I am using "ag-grid": "4.0.5"
in a project with Angular 1.5.2 and Typescript with Visual Studio 2015.
The type definitions available for tsd (with the command tsd install ag-grid --resolve --save
installs the following:
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/ag-grid
but this seems to be a very old version 2.1.2 and basically nothing is useful for my project.
I've seen this project has been developed using typescript. Is there any way I can use the project's internal typescript definitions in my project?
I have tried adding
/// <reference path="../../bower_components/ag-grid/main.d.ts" />
on the top of my TS file but as there are no modules/namespaces on that type definition I cannot reference types like before (e.g: ag.grid.GridOptions
) nor I can reference types as if they were available globally (e.g: let test: GridOptionsWrapper
)
My typescript file won't compile.
I am using Visual Studio 2015 as IDE and if there is another way to make Visual studio aware of the internal type definitions at /// <reference path="../../bower_components/ag-grid/main.d.ts" />
I don't know how to do so..
Anyone with similar situation?
PS: See https://www.ag-grid.com/forum/showthread.php?tid=3581&pid=8414 for further details
UPDATED:
I tried the import recommendation as per Niall's answer but as soon as I include the import statement, my internal angular modules cannot be found. Example: I can add:
import bb = require("../../bower_components/ag-grid/main.d");
then the intellisense for bb.
works perfectly finding all the types within the main.d.ts, but then a line such as let a:app.services.IMyService
stops compiling saying that Module 'app' has no exported member services. That was working before adding that require line.
If I simply add
/// <reference path="../../bower_components/ag-grid/main.d.ts" />
then it fails to compile with an error
Cannot compile modules unless the '--module' flag is provided.
I cannot find answers to why I am getting this error.