I am using Twilio Api in my project and I am unable to import the api in my typescript file, when do so it give errors. If I am using this api in my javascript file then it works fine but in typescript it doesn't work.
These are the errors -
ERROR in ./node_modules/aws-sign2/index.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/aws-sign2'
ERROR in ./node_modules/aws4/aws4.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/aws4'
ERROR in ./node_modules/ecc-jsbn/index.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/ecc-jsbn'
ERROR in ./node_modules/http-signature/lib/signer.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/http-signature/lib'
ERROR in ./node_modules/http-signature/lib/verify.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/http-signature/lib'
ERROR in ./node_modules/oauth-sign/index.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/oauth-sign'
ERROR in ./node_modules/request/lib/helpers.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/request/lib'
ERROR in ./node_modules/request/lib/hawk.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/request/lib'
ERROR in ./node_modules/request/lib/oauth.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/request/lib'
ERROR in ./node_modules/scmp/index.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/scmp'
ERROR in ./node_modules/sshpk/lib/key.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/fingerprint.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/signature.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/private-key.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/certificate.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/identity.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/dhe.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/utils.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/formats/pem.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib/formats'
ERROR in ./node_modules/sshpk/lib/formats/ssh-private.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib/formats'
ERROR in ./node_modules/sshpk/lib/formats/openssh-cert.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/sshpk/lib/formats'
ERROR in ./node_modules/twilio/lib/webhooks/webhooks.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/twilio/lib/webhooks'
ERROR in ./node_modules/twilio/node_modules/jwa/index.js
Module not found: Error: Can't resolve 'crypto' in '/home/prajwal/Work/tracexpence/node_modules/twilio/node_modules/jwa'
ERROR in ./node_modules/deprecate/index.js
Module not found: Error: Can't resolve 'os' in '/home/prajwal/Work/tracexpence/node_modules/deprecate'
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'zlib' in '/home/prajwal/Work/tracexpence/node_modules/request'
This is import in typescript file-
import * as twilio from 'twilio';
const obj = {
'accountSid': 'Axxxxxxxxxxxxxxxxxxxxxxx',
'authToken': 'exxxxxxxx',
};
const client = twilio(obj.accountSid, obj.authToken);