When I run npx tsc
, I encounter the following errors:
node_modules/@twilio-labs/serverless-runtime-types/types.d.ts:5:10 - error TS2305: Module '"twilio/lib/rest/Twilio"' does not export 'TwilioClientOptions'.
5 import { TwilioClientOptions } from 'twilio/lib/rest/Twilio';
~~~~~~~~~~~~~~~~~~~
node_modules/@twilio-labs/serverless-runtime-types/types.d.ts:415:10 - error TS2305: Module '"twilio/lib/rest/Twilio"' does not export 'TwilioClientOptions'.
415 export { TwilioClientOptions } from 'twilio/lib/rest/Twilio';
~~~~~~~~~~~~~~~~~~~
The TypeScript files seem to be compiled successfully, but I'm uncertain if it's safe to ignore this error or if there is a fix for it. It appears to be a dependency mismatch issue.
I am aware of the option to add skipLibCheck
in my tsconfig.json to suppress this error, but that may hide other potential issues in the future.
Here are the minimal steps to reproduce the issue:
functions/test.ts
import { ServerlessFunctionSignature } from '@twilio-labs/serverless-runtime-types/types';
export const handler: ServerlessFunctionSignature = async function(
context,
event,
callback
) {
callback(null, true);
}
tsconfig.json
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"outDir": "./compiled",
"rootDir": "./functions",
"strict": true,
"esModuleInterop": true,
"types": ["@twilio-labs/serverless-runtime-types/index.d.ts"],
}
}
package.json
{
"name": "test",
"version": "1.0.0",
"dependencies": {
"@twilio-labs/serverless-runtime-types": "^3.0.0",
"twilio": "^4.23.0"
},
"devDependencies": {
"typescript": "^5.3.3"
}
}
To clarify, the problem lies in the compilation process and not in type hinting or completion features.