NodeJ无法解构属性“ VideoGrant”,因为它未定义

时间:2020-04-06 21:03:19

标签: node.js twilio twilio-taskrouter

我最近将twilio sdk升级到了我收到的最新版本3.40.0

TypeError: Cannot destructure property 'VideoGrant' of '((cov_frq0yd567.s[1]++) , AccessToken)' as it is undefined.
import twilio from 'twilio'
const { AccessToken } = twilio.jwt
const { VideoGrant } = AccessToken

对不起,nodejs对我来说还很陌生,但是当AccessToken.d.ts的内容未更改时,我找不到这怎么引起问题。

Twilio

import * as util from './lib/jwt/taskrouter/util';
import * as FaxResponse from './lib/twiml/FaxResponse';
import * as MessagingResponse from './lib/twiml/MessagingResponse';
import * as VoiceResponse from './lib/twiml/VoiceResponse';
import * as webhookTools from './lib/webhooks/webhooks';

import TwilioClient = require('./lib/rest/Twilio');
import AccessToken = require('./lib/jwt/AccessToken');
import ClientCapability = require('./lib/jwt/ClientCapability');
import TaskRouterCapability = require('./lib/jwt/taskrouter/TaskRouterCapability');

interface TwimlConstructor<T> {
  new (): T;
}

declare function twilio(
  accountSid?: string,
  authToken?: string,
  opts?: TwilioClient.TwilioClientOptions
): TwilioClient;

declare namespace twilio {
  export import Twilio = TwilioClient;
  export interface TwimlInterface {
    VoiceResponse: TwimlConstructor<VoiceResponse>;
    FaxResponse: TwimlConstructor<FaxResponse>;
    MessagingResponse: TwimlConstructor<MessagingResponse>;
  }
  export interface JwtInterface {
    AccessToken: typeof AccessToken;
    ClientCapability: typeof ClientCapability;
    taskrouter: {
      TaskRouterCapability: typeof TaskRouterCapability;
      util: typeof util;
    };
  }
  export const jwt: JwtInterface;
  export const twiml: TwimlInterface;
  export const validateRequest: typeof webhookTools.validateRequest;
  export const validateRequestWithBody: typeof webhookTools.validateRequestWithBody;
  export const validateExpressRequest: typeof webhookTools.validateExpressRequest;
  export const webhook: typeof webhookTools.webhook;
}

export = twilio;

0 个答案:

没有答案