Vonage / vonage-node-sdk

Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Apache License 2.0
375 stars 178 forks source link

Error while assigning type to SMSParams, 'unicode' is not assignable to type 'TypeEnum | undefined', unable to retreive TypeEnum #749

Closed ilpadrello closed 1 year ago

ilpadrello commented 1 year ago

Migrating from v2 to v3, I can't specify the type (encoding) of SMS I want to send. TS error occurs

import { Vonage } from "@vonage/server-sdk";
import { Auth } from "@vonage/auth";

const vonage = new Vonage(new Auth({
    "apiKey": "APIKEY",
    "apiSecret": "APISECRET"
}))

async function sendSms(to:string,from:string,text:string){
    let response = await vonage.sms.send({
        to,
        from,
        text,
        type: 'unicode'
    });
    console.log(response);
}

I can't transpile with the following Typescript error:

error TS2322: Type '"unicode"' is not assignable to type 'TypeEnum | undefined'.

Couldn't find the Typescript Type anywhere!

Expected Behavior

Transpile without error

Current Behavior

Transpiler yelled at me

Possible Solution

???

Steps to Reproduce (for bugs)

Copy and paste the code then tsc -p .

Context

Your Environment

my tsconfig.json:

{
  "compilerOptions": {
    "target": "es2019",
    "module": "commonjs",
    "sourceMap": true,
    "outDir": "./dist", 
    "rootDir": "./ts",
    "removeComments": true,
    "strict": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "noEmitOnError": true,
    "skipLibCheck": true,
  }
}
manchuck commented 1 year ago

@ilpadrello This has been resolved. Please install the latest version of the SDK