Not working in Typescript Build
See original GitHub issue@vonage/server-sdk
is not working in typescript build
Expected Behavior
import VonageLib from '@vonage/server-sdk'
const Vonage = new VonageLib({
apiKey: process.env.VONAGE_API_KEY,
apiSecret: process.env.VONAGE_API_SECRET
})
Needs to work in typescript build too. Not just in TS environment.
Current Behavior
The code is fine in typescript, but when build is created it makes the following JS code:
const server_sdk_1 = require("@vonage/server-sdk");
const Vonage = new server_sdk_1.default({
apiKey: process.env.VONAGE_API_KEY,
apiSecret: process.env.VONAGE_API_SECRET
});
Then the build gives the following error in production(running js code):
Cloud Function TypeError: server_sdk_1.default is not a constructor
If I change the import to import * as VonageLib from '@vonage/server-sdk'
, typescript gives the error This expression is not constructable.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
typescript compiler (tsc) command not working with tsconfig
this is the problem: C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\tsc.exe C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\tsc.js.
Read more >Common TypeScript module problems and how to solve them
Introduction · Problem 1: Irregular location of dependencies · Solution 1: Locate the correct directory · Problem 2: Multiple fallback locations.
Read more >TypeScript Compiling with Visual Studio Code
A problem matcher parses build output based on the specific build tool and provides integrated issue display and navigation. VS Code ships with...
Read more >TS does not compile .ts files #32326 - microsoft/TypeScript
It looks like this is a question rather than a bug report. This issue tracker is for tracking bugs and active work on...
Read more >TypeScript: JavaScript With Syntax For Types.
TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale. Try TypeScript Now. Online or...
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 @kellyjandrews. Using
esModuleInterop
solved the problem for me.@shihabuddin Thanks - I’ll take a look and see if I can figure it out. My typescript is still a bit shaky. PRs with solutions also welcome - sorry for the troubles 😦