Argument of type '{ apiKey: string; apiSecret: string; }' is not assignable to parameter of type 'AuthInterface'
See original GitHub issueMigrating from v2, I can’t instantiate a Vonage object. From README.md :
const { Vonage } = require('@vonage/server-sdk');
const vonage = new Vonage({
apiKey: API_KEY,
apiSecret: API_SECRET,
applicationId: APP_ID,
privateKey: PRIVATE_KEY_PATH,
signatureSecret: SIGNATURE_SECRET,
signatureMethod: SIGNATURE_METHOD
}, options);
To suit our coding guidelines, I use:
import { Vonage } from '@vonage/server-sdk';
const vonage = new Vonage({
apiKey: ##REDACTED##,
apiSecret: ##REDACTED##,
}, { debug: false });
I can’t transpile with the following Typescript error:
error TS2345: Argument of type '{ apiKey: string; apiSecret: string; }' is not assignable to parameter of type 'AuthInterface'.
Type '{ apiKey: string; apiSecret: string; }' is missing the following properties from type 'AuthInterface': getQueryParams, createSignatureHash, createBasicHeader, createBearerHeader
Expected Behavior
By the doc, Typescript shouldn’t complain and transpile.
Current Behavior
It’s not working mate 😦
Possible Solution
???
Steps to Reproduce (for bugs)
Copy paste code I provide, then tsc -p .
Context
Your Environment
- SDK Version: 3.0.6
- Node Version: (e.g. Node 10.18): 14.20.1
- Operating System and version: macOS 13.0.1
- Typescript: 4.9.3
my tsconfig.json as follows:
{
"compilerOptions": {
"target": "es2019",
"module": "commonjs",
"sourceMap": true,
"outDir": "../dist",
"rootDir": ".",
"removeComments": true,
"strict": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"noEmitOnError": true,
"skipLibCheck": true,
},
"references": [
{ "path": "../" }
]
}
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Argument of type '[string]' is not assignable to parameter of ...
My best answer is that U in memoized_async is not actually (string | number | boolean | undefined)[] . If I did this:...
Read more >Typescript error "Type 'string' is not assignable to type ... - GitHub
Typescript doesn't want to compile this because the string value isn't considered the same type as the enum value, even though the strings...
Read more >Angular | null' is not assignable to parameter of type 'string'
The TypeScript interface for the JSON.parse() function defines a string parameter as the first argument, whereas the interface for localStorage.
Read more >Argument of type 'string' is not assignable to parameter of type
The React component works fine and displays the right icon based on the string it receives back from the API based on my...
Read more >Argument type 'string or null' not assignable to parameter of ...
The error "Argument of type 'string | null' is not assignable to parameter of type string" occurs when a possibly `null` value is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @Kirween. This obviously works. Someone to fix the README.md?
Based on the Typescript declaration, this should work