Currently, I am utilizing "ag-grid": "4.0.5"
in a project that involves Angular 1.5.2 and Typescript within Visual Studio 2015.
When trying to install the type definitions through tsd using the command
tsd install ag-grid --resolve --save
, it installs an outdated version (2.1.2) from
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/ag-grid.
Unfortunately, this older version does not provide any functionality useful for my current project.
I noticed that the project was developed using typescript. Is there a way for me to use the internal typescript definitions of this project? I attempted to add
/// <reference path="../../bower_components/ag-grid/main.d.ts" />
at the beginning of my TS file, but due to the lack of modules/namespaces in that definition file, I am unable to reference types as before (e.g: ag.grid.GridOptions
) or access types globally (e.g: let test: GridOptionsWrapper
).
As a result, my typescript file does not compile.
I am currently using Visual Studio 2015 as my IDE and if there is another method to integrate the internal type definitions mentioned above with Visual Studio, I am unaware of it.
Has anyone encountered a similar issue?
For more information, you can visit https://www.ag-grid.com/forum/showthread.php?tid=3581&pid=8414.
UPDATE: After following Niall's suggestion to use import statements, I faced issues where my internal angular modules were no longer being recognized. For instance, when I added:
import bb = require("../../bower_components/ag-grid/main.d");
the intellisense for bb.
worked smoothly, displaying all types within the main.d.ts file. However, attempting to define a variable like let a:app.services.IMyService
resulted in a compilation error stating that Module 'app' does not have any exported members under services. This was functioning prior to introducing the require statement.
If I simply include
/// <reference path="../../bower_components/ag-grid/main.d.ts" />
it fails to compile with the error message
Cannot compile modules unless the '--module' flag is provided.
I am uncertain about the cause of this error and how to resolve it.