i'm trying to use ag-grid in my application with react and typescript. ag-grid .d.ts files are inside the project so i can't install then with typings install --save...
The problem is when i try to import it...
import { AgGridReact } from 'ag-grid-react';
I'm using VSCode... it shows me "[ts] cannot find module", while compiling same thing.
More info about the application: tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": false,
"removeComments": false,
"sourceMap": false,
"target": "es5",
"module": "system",
"jsx": "react"
}
}
typings.json
{
"name": "focco-sys-jspm",
"dependencies": {
"react": "registry:npm/react#15.0.1+20160601175240",
"react-addons-update": "registry:npm/react-addons-update#0.14.0+20160324044346",
"react-dom": "registry:npm/react-dom#15.0.1+20160705210405",
"react-router": "registry:npm/react-router#2.4.0+20160811060709"
}
}
Finally i tried to include the references in my typings file index.d.ts
/// <reference path="modules/react-addons-update/index.d.ts" />
/// <reference path="modules/react-dom/index.d.ts" />
/// <reference path="modules/react-router/index.d.ts" />
/// <reference path="modules/react/index.d.ts" />
/// <reference path="../jspm_packages/npm/ag-grid@5.4.0/main.d.ts" />
/// <reference path="../jspm_packages/npm/ag-grid-react@5.4.0/main.d.ts" />
Change your typings.json
to
{
"name": "focco-sys-jspm",
"dependencies": {
"react": "registry:npm/react#15.0.1+20160601175240",
"react-addons-update": "registry:npm/react-addons-update#0.14.0+20160324044346",
"react-dom": "registry:npm/react-dom#15.0.1+20160705210405",
"react-router": "registry:npm/react-router#2.4.0+20160811060709",
"ag-grid": "13.1.x",
"ag-grid-react": "13.1.x"
}
}
Once you have included these two dependencies go to your root package folder and open a command prompt from there. In the command prompt enter npm install
. It should install the ag-grid
dependencies.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.