I have the following small typescript project with this dummy main file:
import icaljs from 'ical.js'
icaljs.parse("")
The following package.json:
{
"scripts": {
"build": "tsc"
},
"dependencies": {
"ical.js": "2.2.0"
},
"devDependencies": {
"typescript": "5.8.3"
}
}
And the following tsconfig.json:
{
"compilerOptions": {
"rootDir": "src",
"target": "es2022",
"module": "commonjs",
"sourceMap": true,
"outDir": "build",
},
"exclude": [
"node_modules"
]
}
When I try to build the project with npm run build, I obtain the following compilation error:
node_modules/ical.js/dist/types/period.d.ts:126:17 - error TS2503: Cannot find namespace 'ICAL'.
126 compare(dt: ICAL.Time | ICAL.Period): 0 | 1 | -1;
~~~~
node_modules/ical.js/dist/types/period.d.ts:126:29 - error TS2503: Cannot find namespace 'ICAL'.
126 compare(dt: ICAL.Time | ICAL.Period): 0 | 1 | -1;
~~~~
Found 2 errors in the same file, starting at: node_modules/ical.js/dist/types/period.d.ts:126
In ical.js code, replacing ICAL.Time with simply Time and ICAL.Period with simply Period seems to solve the above compilation problem.
I have the following small typescript project with this dummy main file:
The following
package.json:{ "scripts": { "build": "tsc" }, "dependencies": { "ical.js": "2.2.0" }, "devDependencies": { "typescript": "5.8.3" } }And the following
tsconfig.json:{ "compilerOptions": { "rootDir": "src", "target": "es2022", "module": "commonjs", "sourceMap": true, "outDir": "build", }, "exclude": [ "node_modules" ] }When I try to build the project with
npm run build, I obtain the following compilation error:In ical.js code, replacing
ICAL.Timewith simplyTimeandICAL.Periodwith simplyPeriodseems to solve the above compilation problem.