I’m upgrading gantt 6.0.2 to 6.1.0 and have an error when compiling
ERROR in node_modules/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(5,6): error TS2300: Duplicate identifier ‘GanttCallback’.
node_modules/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(8,6): error TS2300: Duplicate identifier ‘GanttEventName’.
node_modules/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(2272,5): error TS2300: Duplicate identifier ‘export=’.
node_modules/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(2278,5): error TS2300: Duplicate identifier ‘export=’.
src/assets/vendor/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(5,6): error TS2300: Duplicate identifier ‘GanttCallback’.
src/assets/vendor/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(8,6): error TS2300: Duplicate identifier ‘GanttEventName’.
src/assets/vendor/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(2272,5): error TS2300: Duplicate identifier ‘export=’.
src/assets/vendor/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(2278,5): error TS2300: Duplicate identifier ‘export=’.
Please help.
Thanks
ramil
February 26, 2019, 4:12pm
#2
Hello,
It happens because the 6.1.0 version has included types, you don’t need types from “Definitely typed” repository anymore.
To fix the errors, you need to apply the following command:
npm uninstall @types/dhtmlxgantt -save-dev
And make sure that tsconfig.app.json
file doesn’t contain the following string:
"types": [
"dhtmlxgantt"
]
It’s doesn’t work.
I have run
npm uninstall @types /dhtmlxgantt -save-dev
and check my tsconfig.json
{
“compileOnSave”: false,
“compilerOptions”: {
“outDir”: “./dist/out-tsc”,
“sourceMap”: true,
“declaration”: false,
“moduleResolution”: “node”,
“emitDecoratorMetadata”: true,
“experimentalDecorators”: true,
“target”: “es6”,
“module”: “esnext”,
“typeRoots”: [
“node_modules/@types ”
],
“lib”: [
“es2016”,
“dom”
]
},
“skipLibCheck”: true
}
But error still happend
ERROR in node_modules/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(5,6): error TS2300: Duplicate identifier ‘GanttCallback’.
node_modules/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(8,6): error TS2300: Duplicate identifier ‘GanttEventName’.
node_modules/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(2272,5): error TS2300: Duplicate identifier ‘export=’.
node_modules/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(2278,5): error TS2300: Duplicate identifier ‘export=’.
src/app/shared/widgets/sm-gantt-chart/sm-gantt-chart.component.ts(9,30): error TS2306: File ‘node_modules/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts’ is not a module.
src/assets/vendor/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(5,6): error TS2300: Duplicate identifier ‘GanttCallback’.
src/assets/vendor/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(8,6): error TS2300: Duplicate identifier ‘GanttEventName’.
src/assets/vendor/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(2272,5): error TS2300: Duplicate identifier ‘export=’.
src/assets/vendor/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts(2278,5): error TS2300: Duplicate identifier ‘export=’.
ramil
February 27, 2019, 1:30pm
#4
Hello,
You need to modify tsconfig.app.json
, not tsconfig.json
:
Before the uninstalling the types and removing them from tsconfig.app.json
:
After the uninstalling the types and removing them from tsconfig.app.json
:
1 Like
It’s my tsconfig.app.json
{
“extends”: “…/tsconfig.json”,
“compilerOptions”: {
“outDir”: “…/out-tsc/app”,
“baseUrl”: “./”,
“module”: “esnext”,
“types”: []
},
“exclude”: [
“test.ts”,
“**/*.spec.ts”
]
}
But error still happend
ramil
February 28, 2019, 8:36am
#6
Hello,
Thank you for the clarification.
Let’s try deleting node_modules/@types/dhtmlx_gantt
folder, maybe the types still remain there.
If that doesn’t help you, please send me your project as it seems that you might have something specific, but I cannot reproduce it.
1 Like
Thanks.
Because I store ‘dhtmlx-gantt’ professional folder inside project folder. I’ve exclude to build this folder in
tsconfig.app.json
It’s still have an error:
ERROR in src/app/shared/widgets/sm-gantt-chart/sm-gantt-chart.component.ts(9,30): error TS2306: File ‘/Volumes/…/projects/…/node_modules/dhtmlx-gantt/codebase/dhtmlxgantt.d.ts’ is not a module.
ramil
March 1, 2019, 5:32pm
#8
Hello,
It is hard to suggest what might be wrong as I don’t see your code and I cannot reproduce the issue locally.
Maybe it happens because you launch Gantt from another Angular application, like this:
Main Angular Application
Gantt + Angular
Export + Angular
Custom Angular App
Maybe it happens because Gantt loads before another component.
Or maybe there is something else.
Here is what I found regarding that error:
angular
opened 08:37PM - 02 Sep 16 UTC
closed 09:06PM - 24 Apr 17 UTC
External
@types
**TypeScript Version:** 2.0.2
I previously installed typescript declarations u… sing
`npm install @types/lodash`
I have the following in my `tsconfig.json`
``` ts
{
"compilerOptions": {
"module": "amd",
"target": "es5",
"noImplicitAny": false,
"moduleResolution":"node", // using this lets us have rootDirs resolve stuff like moment with "./moment"
"rootDirs": ["node_modules","./", "node_modules/@types"],
"sourceMap": false,
"newLine": "LF",
"declaration": true,
//"allowSyntheticDefaultImports": true
//"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"baseUrl": ".",
"lib":["es5","es2015.promise"],
"paths": {
"N/*": [
"node_modules/@hitc/netsuite-types/N/*"
]
}
},
//"include": ["EC_Logger.ts", "DataAccess/*.ts"]
"include": ["EC_Logger.ts"]
//"exclude": ["node_modules", "test", "declarations"]
}
```
Then in `EC_Logger.ts` I have the following import
``` ts
import * as _ from "./lodash"
```
results in
``` text
======== Type reference directive 'lodash' was successfully resolved to '/home/shawn/s/netsuite-fasttrack-toolkit-ss2/node_modules/@types/lodash/index.d.ts', primary: true. ========
EC_Logger.ts(8,20): error TS2306: File '/home/shawn/s/netsuite-fasttrack-toolkit-ss2/node_modules/@types/lodash/index.d.ts' is not a module.
```
If I change the import to be non relative, it resolves successfully and to **_the same physical file_** and compiles without error:
``` ts
import * as _ from "lodash"
```
results in the following, and no compile error.
``` text
======== Type reference directive 'lodash' was successfully resolved to '/home/shawn/s/netsuite-fasttrack-toolkit-ss2/node_modules/@types/lodash/index.d.ts', primary: true. ========
```
**Expected behavior:**
The module should be recognized as a a valid module in both forms of import statements since it resolves to the same exact file?
**Actual behavior:**
'file is not a module' error when using relative path `./lodash`, no error if using plain `lodash`
Well, at least this thread will be a great resource for anybody else with a similar problem, because they’ll easily find it by searching for the text of their error message. Oh wait, no it won’t, because all the relevant info is unsearchable due to...
Hi,
we’ve just updated our angular demo on the github to gantt 6.1
Can you please check it to see if it helps?
As for the error
ERROR in src/app/shared/widgets/sm-gantt-chart/sm-gantt-chart.component.ts(9,30)
can you pls show the line of code where it’s thrown?
Please tell my what’s the correct way to import gantt 6.1.0 in angular. I found 2 ways in two example
The first time I follow by gantt documentation => error
Now, I follow by angular example project as you mention => correct
in gantt documentation
in your sample project
ramil
March 13, 2019, 11:42am
#11
Hello Long,
Both ways should work, but only the second one works.
The dev team will fix it in the future.
1 Like
Yes, right now there is an issue with our type definitions. We’ll try to update them shortly.
1 Like
ouassim
January 6, 2020, 4:55pm
#13
Is the es6 import now working ?
1 Like
ramil
January 9, 2020, 9:50am
#15
Hello,
Looks like it doesn’t work in the current version (6.3.4). I added it as a bug in our internal tracker, and it will be fixed in the future. Unfortunately, I cannot give you any ETA.
ramil
April 23, 2020, 2:12pm
#16
Hello,
The dev team fixed the issue in the 7.0.0 version:
https://docs.dhtmlx.com/gantt/whatsnew.html#x4466x70x4467x