While working on my Ionic app, I encountered an issue every time I attempted to use the twilio-chat
library in my project through npm install. The error consistently appeared in the .d.ts
files.
Here is how I imported it in my provider :
import { Client } from "twilio-chat";
Errors: https://i.sstatic.net/wv0o0.png
It seems like the .d.ts
files are unable to locate the necessary dependency modules. Could this be related to typings in TypeScript? I am relatively new to TypeScript.
However, when I switched to using the CDN, everything worked perfectly fine.
The versions I am using are as follows:
ionic: "3.18.0"
typescript: "2.2.1"
twlio-chat: "1.2.1"
Update: I managed to resolve the issues with SyncClient and Emc Client by mapping out the location of the problematic .d.ts
files. The only setback was that some twilio dependencies such as twilio-transport
, twilsock
, and twilio-notifications
did not have corresponding .d.ts
files.
My tsconfig.json file includes:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015"
],
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5",
"baseUrl": ".",
"paths": {
"twilio-sync": ["node_modules/twilio-sync/lib"],
"twilio-ems-client": ["node_modules/twilio-ems-client/lib"]
}
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
Thanks in advance!